0

I have created a classpath in command prompt. Later I want to change that classpath to another location. Please help me. Thanks

I have entered the command "set classpath= d:/java" Now i want to change this class path to some another location.

Thanks

2
  • 1
    Again do the same command with new path Commented Mar 4, 2014 at 10:43
  • Open a new command prompt. and type again the new classpath. for eg. set classpath=%classpath%;.;d:/java/example.jar. Once your open a new command window it would have the default classpath and your previous trials in another window would go away as you expected. Commented Mar 4, 2014 at 10:46

3 Answers 3

1

As per my understanding you want to change the classpath which you have set by command
set classpath=d:java

can be done in two ways either you can set classpth directly as environment varible by
--> Right click on my computer select advanced options
--> there you will see option as environment variables open that option
--> now you will see multiple variables being set...search for classpath variable if it exist their edit this variable value by just putting semicolon and write ur full classpath ended by semicolon and save it.
FOR EG:-

variable name:- CLASSAPTH variable value- .;C:\Oracle\product\10.1.0\Client_2\jdbc\lib\ojdbc14.jar; 

Second option is just set your class in command promt as u have set earlier

by opening command prompt

set classpath=C:\Oracle\product\10.1.0\Client_2\jdbc\lib\ojdbc14.jar; 

both the method are easy but i would prefer you should go with first one as by doing that you didn't need to set your classpath again and again after you reboot your system or application.

Sign up to request clarification or add additional context in comments.

Comments

1

If u want to do while running your java program ,you can use

java -classpath C:\java\MyClasses utility.myapp.Cool 

for more details about class path see oracle documentation about classpath.

2 Comments

java -cp is a little shorter ;)
@Gimby yes -cp will be shorter and nice. +1.
0

From the desktop, right click the Computer icon. Choose Properties from the context menu. Click the Advanced system settings link. Click Environment Variables. In the section System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New. In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. Click OK. Close all remaining windows by clicking OK.

For e.g: PATH=/usr/local/jdk1.7.0/bin:

1 Comment

OP is talking about classpath not path.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.