This week's book giveaways are in the iOS and Features new in Java 8 forums. We're giving away four copies each of Barcodes with iOS: Bringing together the digital and physical worlds and Core Java for the Impatient and have the authors on-line! See this thread and this one for details.
I just installed Win2k at home, and I have a problem with my Java installation.
Using textpad, I write the following very simple program, many of you have probably seen it before!This compiles wonderfully, but will not run. Here is what I get from both Textpad's Ctrl-2, and directly from a console window: My very basic doubt, which I suppose could be answered by trying it out, is this: I don't currently have an environment variable called CLASSPATH. Do I need one, if I do, what should it say, and why do I need one?
If this is not the problem, then what could possibly be wrong?
The reason I even knew I had this problem was that I tried to install a library of classes from Infragistics and the install program (which was an exe) couldn't find either of two Java Runtimes, and when I pointed them right at java.exe, it said "This does not appear to be a valid java runtime". I tried java.exe under the jre and then I decided to download the class file version of the same download... and it had the same "Exception in thread main..." error. So I tried the simplest thing I knew how.. hello world, and it doesn't work either.
Any ideas? p.s. I compiled and ran a few things a few days ago and the only thing different since then is I upgraded my IDE controller BIOS - think that has anything to do with it?
Hi,maybe this can help you. Just add these on your autoexec.bat or write a new bat file with these lines and run it.(I installed jdk on "E:\jdk",you can replace it wiht your dirctory.): SET JAVA_HOME=E:\JDK SET PATH=E:\JDK\BIN SET CLASSPATH=E:\JDK\LIB\TOOLS.JAR;E:\JDK\LIB\DT.JAR Good luck
JAVA_HOME is already set to c:\jdk1.3.1 PATH doesn't seem to be necessary, because from any directory, I can find both java.exe and javac.exe and if I know my CLASSPATH correctly, which was my basic doubt... I don't need to explicity add tools.jar or dt.jar, do I?
I try it just now and I found you are right.It is not necessary.Just add your classpath and it will work.You can right click "my computer" to choice "properties",click "advance-->environment-->setting",and you will find "classpath" there.Edit it,add the directory your class be in.Login again and it will be OK. Or just simply write a bat file like that(env.bat): ----------------------------------- SET JAVA_HOME=E:\JDK SET PATH=E:\JDK\BIN SET CLASSPATH=E:\JDK\LIB\TOOLS.JAR;E:\JDK\LIB\DT.JAR;E:\myjava ------------------------------------ Once you run java,you run this bat file first. It really work. Luck. [This message has been edited by John Lennon (edited July 05, 2001).]
I guess my basic doubt boils down to: I thought the java runtime was smart enough to look in '.' without my having to add it to CLASSPATH.
I don't currently have a CLASSPATH entry at all, and p.s. You don't need to re-login on winNT or win2k. You just can't reuse an old Console window. Once you open a new Console, it has the new settings.