How to set PATH and Class Path to run JAVA program

 

Set PATH and Class Path to run JAVA program

If you have installed JRE and unable to run the java program, then stop for a moment, you will not be able to run the program till you do not set the path and classpath of your installed JRE.

If you want to set path and classpath using command prompt

1. PATH

SYNTAX

C:\>set path=%path;C:\Java\jdk1.6.0_03\bin%

Here you have to give the JDK/bin directory path

2. Classpath

SYNTAX

C:\>set classpath=%classpath;C:\Java\jdk1.6.0_03\lib%

Here you have to give the JDK/lib path

If you are using windows to set the path and classpath, just follow the steps

Right Click on the MyComputer > Properties > Advanced > Environment Variables

 

Advanced TAB

1

Now you will have a window showing user variables and System variables.

You have to find the variable name path, if it already contains path variable, just edit the path folder and edit the value, include ;C:\Java\jdk1.5.0_03\bin; after the last value.

JAVA path variable

2

If you are unable to find the PATH folder, just create new and give variable name path and value C:\Java\jdk1.5.0_03\bin

JAVA Classpath variable

3

Same case in CLASSPATH, if already contains, just edit it with ;C:\Java\jdk1.5.0_03\lib; or create it and give name CLASSPATH and value C:\Java\jdk1.5.0_03\lib

Now you can compile and run the java program easily.

I will show you the steps in my video tutorials.

SET JAVA PATH and CLASSPATH in Window 7

How to Install Java

Setting up your computer to run Java

R K Gupta

Hi, This is R K Gupta, an IT professional and Entrepreneur. I have written many articles yet for my websites gsesoftsolutions.com, Hope you like it. Kindly subscribe our feed for any updates. Add me in Facebook and Google+

More Posts - Website

Follow Me:
TwitterFacebookPinterestYouTube

Hi, This is R K Gupta, an IT professional and Entrepreneur. I have written many articles yet for my websites gsesoftsolutions.com, Hope you like it. Kindly subscribe our feed for any updates. Add me in Facebook and Google+

Posted in Blogging, GSE Blogging