Signup/Sign In

Setting Java Environment and Classpath

An Environment variable is a dynamic "object" on a computer that stores a value(like a key-value pair), which can be referenced by one or more software programs in Windows. Like for Java, we will set an environment variable with name "java" and its value will be the path of the /bin directory present in Java directory. So whenever a program will require Java environment, it will look for the java environment variable which will give it the path to the execution directory.


Setting up path for windows ( 2000/XP/vista/Window 7,8 )

Assuming that you have installed Java in C:\ Program files/ Java / JDK directory

Step 1: Right click on my computer and select properties.

setting classpath in java


Step 2: Go to the Advance System Settings tab.

setting classpath in java


Step 3: Click on Environment Variables button.

setting classpath in java


Step 4: Now alter the path variable so that it also contains the path to JDK installed directory.

setting classpath in java

For e.g:- Change C:\windows/ system 32. to C:\windows/system 32; C:\program files / Java/ JDK.


Setting up path for window 95/98/ME

Assuming that you have installed Java in C:\program files\ java\ JDK directory, do the following:

Step 1: Edit the C:\autoexec.bat file and add the following line at the end.

SET PATH =% PATH% C:\ PROGRAM FILE/JAVA/JDK/bin 


Setting up path for Linux , Unix , Solaris, free BSD

Step 1: Environment variable path should be set to point where java binaries have been installed. Refer to your shell if you have trouble doing this.

For Example: If you use bash as your shell, then you would add following line to the end

bash mc: export PATH=/ Path/to/java 

We recommend you to download latest Java 11 version. Java 11 is a LTS(Long Term Support) version and currently widely in used. You can refer our step by step installation guide to install the Java 11.

Recommended Java Version: Download the latest version of JDK