Friday, January 2, 2015

How to Set Path and Classpath in java: Steps with Screenshots

The Path is the system variable that your operating system uses to locate needed executable files from the command line or Terminal window. Here in java javac.exe, java.exe and other executable files needed to compile and run your java program. You can find these files under bin folder of java.

Java Classpath

Follow the below steps in order to set java path and classpath in Windows:

1. Right click on “My Computer” icon. Choose Properties from the context menu.Click on Advance System settings.


2. System Properties open up. Click on Advanced tab.


3. Click on Environment Variables…Environment Variables window opens up. Search for path under Systems variables and click Edit…(You can also double click on the entry to open the path in edit mode). You may create a new path variable if the path entry is not there under Systems variables.


4. Edit system variables window opens up. Put a semi colon(;) at the end of the environment value to enter your JAVA_HOME\bin and click OK. Please make sure you append the value with the existing one.


I am going to put a semi colon after …\Shared; (see above image) and add my java path. My java installed in c:\Program files so I will enter  C:\Program Files\Java\jdk1.8.0_25\bin as my java path.


6. You are done. Open command prompt and run your java code.

You can also set your path using command prompt. Just enter the below command.

set Path=C:\Program Files\Java\jdk1.8.0_25\bin

If command prompt throws ‘javac’ is not recognized as an internal or external command,operable program or batch file then you have done some mistake please recheck the path you have entered.

The above screen shots are from Windows 8.1. If you find any difficulties in the steps please let me know in comment section. I will reply to your comment as soon as possible.

Please do not forget to post your valuable comments and feedback. You can also post your queries in comment section I will be more than happy to help you.


  1. Your article has a full of learnings,please take time to view my site Thank you and God bless :)

  2. Annyeong!Thanks for sharing your interesting article, please do visit my site too God Bless :)