Setting Classpath for Java

Java is freely available on Oracle's Website. Download the latest version of JDK (Java Development Kit) on your machine. Do check whether your machine is 32 bit or 64 bit and download that particular Java version. Install JDK on your machine. Once you have installed Java on your machine you would need to set environment variable to point to correct installation directory.

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

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

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 


Quantitative Aptitude
Reasoning
Programming
Interview