I have been programming in java for about 6 months writing small programs to learn different areas of Java. I always compile and run the programs I create from the command line (dos prompt - Ex: javac TestProgram.java & java TestProgram). My programs after debugging have always ran just fine, but I cannot tell anywhere on my Win98 computer where I have a "classpath" set.
Today, I ran into a situation where I needed to refer to a specific jar file. I read information on the "classpath" and I explicitly put it in the command line as "java -classpath ..\lib\test.jar TestProgram" and it found the jar file and ran fine.
Question: I am confused on the use of the "classpath". Should I always have one and if so, why has this NOT bitten me in the foot sooner?
Additional information:
- JDK version 1.3.0
- I have a path set in my autoexec.bat that refers to my
JDK "bin" folder. I cannot see any other "set" type commands
to "set" the classpath.
- I never have put the "-classpath" in until today.
Thanks for your time.
Today, I ran into a situation where I needed to refer to a specific jar file. I read information on the "classpath" and I explicitly put it in the command line as "java -classpath ..\lib\test.jar TestProgram" and it found the jar file and ran fine.
Question: I am confused on the use of the "classpath". Should I always have one and if so, why has this NOT bitten me in the foot sooner?
Additional information:
- JDK version 1.3.0
- I have a path set in my autoexec.bat that refers to my
JDK "bin" folder. I cannot see any other "set" type commands
to "set" the classpath.
- I never have put the "-classpath" in until today.
Thanks for your time.