File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes please tell me how to set class path Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "please tell me how to set class path" Watch "please tell me how to set class path" New topic

please tell me how to set class path

Arul Jose
Ranch Hand

Joined: Jan 14, 2005
Posts: 131
please tel me how to set the classpath EXACTLY. im working in windows XP.

can we do it like this?
go to properties in 'my computer' and then add the current directory for the variable 'classpath'?

how else to do it?

Sanjaya Sugiarto
Ranch Hand

Joined: Mar 25, 2004
Posts: 229
Start > Settings > Control Panel > System > Advanced > Environment Variables > Than you can add a new variable (CLASSPATH -> where the actual workpsace is and JAVA_HOME -> home directory where you install java)

<a href="" target="_blank" rel="nofollow">Business Information Technology - Hochschule Furtwangen University, Germany</a>
Arul Jose
Ranch Hand

Joined: Jan 14, 2005
Posts: 131
hi ranch,

Thank you for your reply. it helped me.

Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Alternatively, set it for the shell you run your java app in. (i.e. open a new DOS command window, and type SET CLASSPATH=[whatever]). This way your classpath is set only for the application to which it applies, not every application you subsequently run.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
And a third option! On the command that starts java, specify classpath with a -cp parameter.

This is typical of how I start things from bat files. Hmm, "arg" wasn't a very good name for the string I built, was it.

[ January 18, 2005: Message edited by: Stan James ]

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
It is sorta covered in the JavaRanch Style Guide.
subject: please tell me how to set class path
It's not a secret anymore!