How to set the classpath using a java program without setting it form command line?
-
6 ways to set the classpath: javahowto.blogspot.com/2006/06/…miku– miku2010-05-27 12:32:53 +00:00Commented May 27, 2010 at 12:32
-
@MYYN - it's four to me, the first two are equivalent and the 'current directory' thing is too trivial and limited ;)Andreas Dolk– Andreas Dolk2010-05-27 12:36:34 +00:00Commented May 27, 2010 at 12:36
Add a comment
|
2 Answers
There are three common ways to set the classpath:
- define the environment variable
CLASSPATH - add
-cpargument to the java call - declare the classpath in a jar manifest file.
I recommend the second option. Just write a shell script or batch file that executes java with the classpath and the class containing the main method.