File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes how to set class path? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how to set class path?" Watch "how to set class path?" New topic
Author

how to set class path?

krishna balaji
Ranch Hand

Joined: Mar 16, 2006
Posts: 31
i included a jar file in my project and i m required to mention jar file location each time i compile and run the code how to set class path in advance ?
<code>
javac -cp location/myjarfilename.jar;. myclass.java
java -cp location/myjarfile.java;. myclass
<code>

this is wat i m doin i want to set class path and do like
<code>
java -cp myjarfile.jar;. myclass.java
java -cp myjarfile.jar;. myclass
<code>
how to set class path before compiling and running?like we set path to jdk
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40027
    
  28
Like we set path to jdk.

Yes, that is exactly how you do it. Probably a bad idea to set the classpath permanently, but if you want to do it, do exactly what you do for setting path, but click the classpath environment variable instead.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40027
    
  28
There is another post about setting classpath here. It has more useful discussion about classpaths, which I think would be helpful for you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to set class path?