- A compiler
- A good self-study book or a course
There are three editions of Java:
- SE: Standard Edition
- ME: Mobile Edition
- EE: Enterprise Edition
Then you chooes what you want the SE which is Standard Edition. The others are Mobile Edition and Enterprise Edition.
After you have downloaded and installed the JDK,
You need to make one small change in your PC settings. You want the compiler to be accessible from the command prompt.
To do that you have to add the location of the program files to the PATH variable.
1: Click Start → Control Panel → System ( assuming you use Windows 10)
2: Click Advanced → Environment Variables.
3: Find the location of the bin folder in your installation. You can do this by using the Explorer. It’s a good idea to copy the path from there.
It might be: “C:/Programs/Java/jdk1.6.0_23/bin”
4: Add the location to the PATH variable. You probably already have a PATH variable, so choose Edit for that one add a semicolon in the end and the location you copied in step 3
You can test if it is working by opening a command prompt and type JAVAC. This should make the compiler run. Since you did not give a file name as parameter, it just shows you the help file.
Now that you have the compiler working, it is time to make your first Java application. Open notepad or any other simple text editor and type in the following text exactly like shown here.
Then save the file as “HelloWorld.java” in the folder where you want to keep your Java projects. Make sure you don’t save it with the.txt extension, even thou it is a text-only file.
Go back to your command prompt and type:
This will tell the Java compiler to translate the file you just made. If there is no errors you will now have a file called “HelloWorld.class”. This is the byte code version of your program. It cannot be run as you would do with an executable program file. Instead you need the Java interpreter. You can test your program with the
Note that you don’t need the.class extension. You should now get the output from your program:
Congratulations! You have now made and tested your first Java program. I recommend you also try to make a small change, to get a feel of how things work. Of course it is difficult now, as most of the code don’t make much sense when you don’t know Java yet. But you can change the text between the quotation marks to make the program print a different text.