Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting up Classpath

 
Sulbha Jan
Ranch Hand
Posts: 37
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,
I am trying to setup my classpath for my jar file
I set up my classpath in the following way
.;c:\dir\file.jar
But somehow the path is still not established because
when i compile my java program it gives me an error message of
package not found (The class I am using is one of the class defined in that jar file)

But if I specify my classpath while compiling my java program on DOS prompt using javac then it compiles it successfully.
While running my java program (using command java on DOS prompt),again I have to specify the classpath for file.jar, only then the programs runs.
Could anyone please tell where am I going wrong?
On the command prompt I typed echo %classpath% but it does not show
the classspath but instead gives the text %classpath% which I guess it means classpath is not set
Can you explain why? and what is the solution for this.
I also tried setting my user environment variable and giving the value as the path for file.jar, even that didnt work.
Please Please can anyone tell where am i going wrong?
Thanks
[ October 26, 2005: Message edited by: Sulbha Jan ]
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Javaranch has a useful HOW TO here which might help.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This picks up from there and gets into trickier packages & such. Let us know how you work this out!
 
Sulbha Jan
Ranch Hand
Posts: 37
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you! Thank you! to Paul Sturrock and Stan James
It worked. The mistake I was doing was, I was not naming the user environment variable as CLASSPATH..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic