By: Linda Ng in Java Tutorials on 2023-04-23
If you are familiar with C then Java should be very familiar to you in terms of syntax. If you are a C++ programmer the Java will be easier still since Java is also purely an Object Oriented Programming without some of the features like Pointers in C++.
To start programming your first Java program, you need to have some pre-requisites installed on your computer. As with any other programming language, you first need to install the SDK (Software Developer Kit) in this case it is JDK (Java Developers Kit). Now choosing which JDK to download maybe a little tricky if you are new to Java. So it will be advisable to read the How Java is Organised? before you proceed.
You have two options to get started with Java.
- If you want to do it manually, you will need to download a J2SE from Sun website and install on your computer. (The J2SE has many versions and it is better to check at the Oracle website to get the latest JDK.)
- The J2SE download is usually an executable file which will install automatically like any windows software. Or you can use apt-get or yum to install java in linux. (eg.
sudo apt install default-jdk)
- Once the installation is successful, open a command line (DOS Window) and type 'Java' and 'Enter'. (If you see 'Bad command' then probably your PATH settings are wrong. In which add the installation path to the PATH variable from your 'computer properties' environment variables section.)
- Open a Notepad, write your first sample program (you will find many here) and save it as .java file (the name of the file should be same as the name of the CLASS in the program)
- from the command window, change current directory to where you saved your .java file and compile the program ( Use 'javac' command followed by the name of the file to compile)
- Once it is compiled a .class file will be created in the same folder. Then run the program using 'Java' command (Use 'Java' command followed by the name of the class)
- As with any other programming language, Java too has many free IDE (Integrated Development Environments) You can choose any of them. Most of them comes bundled with the required JDKs.
- Jet Brains IDE https://www.jetbrains.com/idea/download/download-thanks.html
- Eclipse https://www.eclipse.org/ide/
- Visual Studio Code https://code.visualstudio.com/docs/languages/java
- Netbeans https://netbeans.apache.org/
This policy contains information about your privacy. By posting, you are declaring that you understand this policy:
- Your name, rating, website address, town, country, state and comment will be publicly displayed if entered.
- Aside from the data entered into these form fields, other stored data about your comment will include:
- Your IP address (not displayed)
- The time/date of your submission (displayed)
- Your email address will not be shared. It is collected for only two reasons:
- Administrative purposes, should a need to contact you arise.
- To inform you of new comments, should you subscribe to receive notifications.
- A cookie may be set on your computer. This is used to remember your inputs. It will expire by itself.
This policy is subject to change at any time and without notice.
These terms and conditions contain rules about posting comments. By submitting a comment, you are declaring that you agree with these rules:
- Although the administrator will attempt to moderate comments, it is impossible for every comment to have been moderated at any given time.
- You acknowledge that all comments express the views and opinions of the original author and not those of the administrator.
- You agree not to post any material which is knowingly false, obscene, hateful, threatening, harassing or invasive of a person's privacy.
- The administrator has the right to edit, move or remove any comment for any reason and without notice.
Failure to comply with these rules may result in being banned from submitting further comments.
These terms and conditions are subject to change at any time and without notice.
Most Viewed Articles (in Java )
Latest Articles (in Java)
- Data Science
- React Native
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews