Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java versus javac classpath

807597Jan 17 2005 — edited Jan 17 2005
hi everyone:

this is a bit embarassing, as I have been using java for some time, but I recently came across a classpath conceptual difficulty.

My understanding was that 'javac' uses classpath to find the path to any classes referenced in a target for compilation. However, I couldn't come up with any concrete rationale for using an additional classpath for 'java', the JVM command, when developing your own applications (I can see its importance for third party classes).

Doesn't javac encode the classpath passed to it in the compiled class file itself? (I figured this because even if I do not specify a classpath to the 'java', the program still executes fine). If this is true, then the only way I see the 'java' classpath being useful is if you were to change around the location of the class files after compilation.

Any thoughts would be greatly appreciated.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 14 2005
Added on Jan 17 2005
7 comments
281 views