I am running JDK1.3.0_02 version on a win95 OS. At the beginning I do not have any classpath declared. My java works fine until I explicitly delcare the classpath in my command window. If I declare: CLASSPATH=C:\JDK1.3.0_02 the execution of my classes with main methods will not work anymore.
The classpath should point to the \lib directory under that directory if you want the system to find any of the classes that are in the Sun jar files. Do try to keep your stuff somewhere else, and add that directory to your classpath.
I also don't understand CLASSPATH. I am using win98 and I don't set up any CLASSPATH in autoexec.bat or somewhere else. All I have set up is just the path points to c:\jdk1.3.1\bin that I can use "javac file.java" anywhere... My question is how come "import java.io.*" works, even I don't have CLASSPATH set up?
Somewhere along the way, they build the VM so that an environment reference back to the core class files wasn't necessary. That is, no matter what you did to the CLASSPATH, the VM would find its own rt.jar file -- assuming of course, you didn't move or delete it. And this does make sense. The core classes are "trusted" in the VM above all else, so it shouldn't be possible to accidentally obscure their use.
Make visible what, without you, might perhaps never have been seen. - Robert Bresson
Path & Classpath W95/W98: in autoexec.bat (make backup before changes! Just in case!) Path=C:\JDK1_3\bin;%PATH%; if the jdk is in file c:\jdk1_3 classpath example below: SET CLASSPATH=%CLASSPATH%;.;C:\JDK1_3\LIB\TOOLS.JAR;C:\JDK1_3 There can be several lines in autoexec.bat that "set classpath". In classpath you tell the PC where to find tools.jar and then remind it where you installed the jdk In W2000, if you have installed the jdk to a local (not network) drive: you have to go to Settings, System, then the middle adjustment area (sorry, no W2000 machine here) and then at the top 1/2 of the page is user settings where you add or append the path and classpath. Path to where javac.exe is installed (Example: C:\jdk1_3\bin), classpath to the file tools.jar, starting with period and semicolon (indicarting installation on a local drive). (Example: .;C:\jdk1_3\lib\tools.jar)
Joined: Jan 05, 2002
W2000 Sorry, the place for setting of class & classpath is System, Advanced, then that center button (sorry, can't remember its text), and that opens the page where you can set user & system values (the latter only if you have system admin status).
Originally posted by Lubosh O: I am running JDK1.3.0_02 version on a win95 OS. At the beginning I do not have any classpath declared. My java works fine until I explicitly delcare the classpath in my command window. If I declare: CLASSPATH=C:\JDK1.3.0_02 the execution of my classes with main methods will not work anymore.
Your CLASSPATH must point to the subdirectory where your classes are. I am referring to the class you are running (i.e. MyClass.class file). Without a classpath, you get a default to the directory you are currently in. If you set it to CLASSPATH=C:\JDK1.3.0_02, your class won't run unless you have compiled it to that subdirectory (which most people usually don't do).
JavaBeginnersFaq "Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt