It's not a secret anymore!
The moose likes Beginning Java and the fly likes classpath question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "classpath question" Watch "classpath question" New topic

classpath question

amouro wu

Joined: Dec 30, 2003
Posts: 1
I can compile using a classpath set up by means of the
environment variable.
I can also compile using the -classpath parameter of the javac line command. The problem comes when using the two together.
Does the -classpath parameter override or overridden by,
precede or succeed the classpath environment variable.
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
The command line classpath overrides the CLASSPATH environment variable setting. If you want to use both, the trick is to include the environment variable in your command-line argument.
On Windows, something like:
java -classpath %CLASSPATH%;some.jar;c:\myprojects\thing\classes
On Linux, Unix, etc. something like:
java -classpath $CLASSPATH:some.jar:/usr/me/myprojects/thing/classes
Does that help?

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
I agree. Here's the link:
subject: classpath question
It's not a secret anymore!