• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Setting up Classpath

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Javaranch has a useful HOW TO here which might help.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
Maybe he went home and went to bed. And took this tiny ad with him:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic