Tuesday, February 10, 2015

how to set java classpath for windows

This post is a step by step guide to set JAVA Classpath & Path in Windows.

Step 1

Go to Control Panel

Step 2

Click User Accounts -> User Accounts

Step 3

Click 'Change my environment Variables'
   There are two types:
  1. User variable,
  2. System variables (should login as admin user).

Step 4

Click New to add a new environmental variable.

Step 5

Set java home
   Variable Name: JAVA_HOME
   Variable Value: c:\Program Files\Java\jdk1.7.0_60

Step 6

Set classpath
   Variable Name: CLASSPATH
   Variable Value:
       c:\Program Files\Java\jdk1.7.0_60\lib;
       (OR) %JAVA_HOME%\lib;

Step 7

Set path
   Variable Name: PATH
   Variable Value:
       c:\Program Files\Java\jdk1.7.0_60\bin;
       (OR) %JAVA_HOME%\bin;

Note

1. classpath should always point the 'lib' folder
2. path should always point 'bin' folder

Test

To make sure whether the java path & classpath are properly set, type 'javac' & 'java' in command prompt.

No comments :

Post a Comment