How to Install Java On Windows?

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.

Right-click-MyComputer-Properties

B. Click on Advanced System Settings or change settings as shown in the screenshot.

Advanced-System-Settings

C. Click on Advanced tab in the pop up window.

system-properties-Advanced-EnvironmentVariables

D. Click on Environment variables

E. To set path follow below steps

F. Click on New under system variables on Environment variables window.

New-button-to-set-environment-variable

G. A pop up window will open

New-System-Variable-Setting

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)

Program-files-java-jdk

Environment-variable-Name

J. Click on OK.

Select-ok-button-in-system-variable

K. You Need to set classpath.

L. Click on New under system variables on Environment variables window.

New-button-to-set-environment-variable

M. A pop up window will open

New-System-Variable-Setting

N. In Variable Name enter any user defined name like classpath

Java-classpath-environment-variable

O. In Variable value enter “C:/Program Files/Java/jdk1.6.0_20/lib”

Java-Environment-variable-lib

Java-classpath-environment-variable-lib

P. Click on OK.

Java-classpath-confirmation

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.

Java-classpath-ok-button

W. Finally java is installed in the system.

X. Press Windows + R and enter cmd in text box.

Java-command-prompt

Java-command-prompt-confirmation

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.

Java-confirmation-command-prompt

Java-set-of-commands

Z. To know the current version of Java you are using. Enter Java -version in command prompt

Java-version-command

Java-version-checking

Setting up the Environment variables for Java:
There are two ways we can set the environment variables.

1.Temporarily
2.Permanantly

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

Leave a Comment

Your email address will not be published. Required fields are marked *