Before working with Java, we need to install Java in the system.
1.Navigate to Download Java
2.Select the appropriate Operating system based on your system configuration. For windows 32 bit download 32 bit JDK and for windows 64 bit download 64 bit JDK.
3.Download the JDK file
How to set path and classpath in windows OS for Java?
For communicating java with windows OS and eclipse we need path, classpath to be set .
A. Right click on My Computer and select properties.
B. Click on Advanced System Settings or change settings as shown in the screenshot.
C. Click on Advanced tab in the pop up window.
D. Click on Environment variables
E. To set path follow below steps
F. Click on New under system variables on Environment variables window.
G. A pop up window will open
H. In Variable Name enter any user defined name like path
I. In Variable value enter “C:Program Files\Java\jdk1.6.0_20\bin” (based on your system location copy the path)
J. Click on OK.
K. You Need to set classpath.
L. Click on New under system variables on Environment variables window.
M. A pop up window will open
N. In Variable Name enter any user defined name like classpath
O. In Variable value enter “C:/Program Files/Java/jdk1.6.0_20/lib”
P. Click on OK.
Q. Now need to add the newly added variable(JAVA_HOME) to existing path.
R. Select Path variable.
Java Path Setting
S. Click Edit button.
Adding Java Variable to System path
T. Select New button as shown below.
Java Environment New System Variables
U. Enter the below text %JAVA_HOME% and click OK button.
Java Envrionment System Variable Added
V. Click OK button to complete the environment setup.
W. Finally java is installed in the system.
X. Press Windows + R and enter cmd in text box.
Y. Enter javac in the command prompt and check if a set of statements is executed with java version as displayed in C:\Program files\Java folder.
Z. To know the current version of Java you are using. Enter Java -version in command prompt
Setting up the Environment variables for Java:
There are two ways we can set the environment variables.
1.Temporarily setting the Environment variable : In the DOS prompt enter this commands
Set PATH=Javainstalldirpath\bin; %PATH%
To recognize Javac.
2.Permanantly setting the Environment variable: Goto My Computer –>Right Click — > Properties –> Advance — > Environment variables
New, Edit to store permanently Set CLASSPATH = .; Javainstalldirpath\JRE\lib\rt.jar; %CLASSPATH%
. indicates current working directory