When you start developing java / j2ee applications you need to setup JAVA on your system. You should setup / configure the JAVA_HOME and path as system properties to compile and execute a Java file.
This setup information is only for Windows OS.
Install JDK (Java Development Kit)
Before starting your configuration you should have the JDK installer downloaded from Oracle website. Earlier it was with Sun Microsystems. You may need to sign-in to get the JDK installer from the website.
Follow some basic steps to log-in and get your installer file. Its pretty simple. After the JDK installer will be downloaded double click on the exe file which will take you through installation process step by step.
Once your JDK got installed follow the steps described below to setup JAVA system property on your machine.
Configure JAVA_HOME
Right click on your 'Computer' icon present in desktop screen of your system. Select 'properties' from the menu list. Then click on 'Advanced system settings'. A System property window will appear as its shown in the following image. Check out for Advanced tab if you don't find the above settings on your OS.
At the bottom of the above window you can see a button labeled as 'Environment Variables'. Click that button. Now you have the setup window where you will add the Java system property.
To add JAVA_HOME as a part of user variables, click on New... button listed under User Variable section. Set JAVA_HOME as variable name. Make sure you are putting the correct variable name. Its a standard variable name used across Java supported applications.
Then browse through your Java installation directory and copy the directory path from address bar of windows explorer. For me its installed under C:/Program Files (x86)/Java directory. Make sure you are selecting the correct path for JAVA_HOME. The home or root directory will have bin, lib, jre and few other subfolders. Copy and paste the directory path into Variable value field. Then select OK button to confirm your settings.
Configure path variable
After setting up the JAVA_HOME property you should set the path variable too in your advance system property. Repeat the above steps to add a new user variable.
In Variable name field add path and in Variable value field add %JAVA_HOME%/bin; value. Then click OK and the settings will be saved.
Test your setup
Now you are ready to test your java setup. To test it open the command line window.
And type java -version in the command window. The installed version will be displayed on your command screen. See the screen below for your reference.
Type java command for more available options. Post your comments if you find any issues in the post.





No comments:
Post a Comment