I cannot figure out how to add jar files the the classpath in Java. Can anyone help?
Michael
-
Adding to the classpath (2 messages)
- Posted by: Michael Rasmussen
- Posted on: October 29 2001 16:05 EST
Threaded Messages (2)
- Adding to the classpath by Brian Cavanagh on October 29 2001 22:54 EST
- Adding to the classpath by Andy Nguyen on October 30 2001 10:22 EST
-
Adding to the classpath[ Go to top ]
- Posted by: Brian Cavanagh
- Posted on: October 29 2001 22:54 EST
- in response to Michael Rasmussen
For example,
if you wished to add ant.jar which is in the directory
c:\ant\lib\ant.jar to the classpath,
from a dos shell type
c:> set classpath=%classpath%;c:\ant\lib\ant.jar
Alternatively you can set it in your environment variables. this will save you having to set the classpath everytime you open a dos shell. Environment variables are set through the control panel -> system
HTH,
Brian -
Adding to the classpath[ Go to top ]
- Posted by: Andy Nguyen
- Posted on: October 30 2001 10:22 EST
- in response to Michael Rasmussen
Another way to add to your classpath is through the java command line.
e.g. jar to add: c:\blah\blah.jar
Command line:
java -classpath %classpath%;c:\blah\blah.jar ClassToExecute
In UNIX environments, replace %classpath% with $CLASSPATH, ';' with ':' and '\' with '/'.
HTH
Andy