Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to set class path?  RSS feed

 
krishna balaji
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 53720
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 53720
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is another post about setting classpath here. It has more useful discussion about classpaths, which I think would be helpful for you.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!