Updating to new JDK

I have downloaded JDK 1.2 and JDK 1.4. I have compiled code using JDK1.2 bu t now I am trying to update my computer to 1.4, and I am having absolutely no luck. What are the exact steps I have to take so that my command prompt will go to the new JDK in order to compile code? Right now "javac" will not work. Thanks.

[322 byte] By [aiche_aga] at [2007-11-27 7:05:13]
# 1
You can either update your system's PATH variable. Or you can type the path on your command prompt. So for example your jdk is in the directory program files, you will have to type:C:\Program Files\JDK\bin\javac filename.java
DarumAa at 2007-7-12 18:56:33 > top of Java-index,Java Essentials,New To Java...
# 2
> I have downloaded JDK 1.2 and JDK 1.4.what wrong with version 6?
TuringPesta at 2007-7-12 18:56:33 > top of Java-index,Java Essentials,New To Java...
# 3
Version 6 won't install, for some reason it says it isn't compatible with my processor.And I've updated the PATH variable but it still isn't working. Are there any other suggestions?Thanks
aiche_aga at 2007-7-12 18:56:33 > top of Java-index,Java Essentials,New To Java...
# 4
Did you try typing in the path manually?
DarumAa at 2007-7-12 18:56:33 > top of Java-index,Java Essentials,New To Java...
# 5
Just for reference, the path (it seems to me) should be C:\j2sdk1.4.2_13\jre\binBut that's not working when I try to use "set path" in the command prompt.
aiche_aga at 2007-7-12 18:56:33 > top of Java-index,Java Essentials,New To Java...
# 6
This is the exact code:C:\>C:\j2sdk1.4.2_13\jre\bin\javac HelloWorld.java"'C:\j2sdk1.4.2_13\jre\bin\javac' is not recognized as an internal or external command, operable program or batch file."
aiche_aga at 2007-7-12 18:56:33 > top of Java-index,Java Essentials,New To Java...
# 7

Just open a command prompt and type in:

"C:\j2sdk1.4.2_13\bin\javac.exe" yourFileName.java

In your post you referred to jre folder. The JRE folder contains the Java Runtime and does not contain javac (Java Compiler). The Java Compiler is under the bin folder of your JDK.

For setting your path:

http://www.cs.ucsb.edu/~teliot/Path_and_Classpath.htm

Hope this helps. Thanks.

DarumAa at 2007-7-12 18:56:33 > top of Java-index,Java Essentials,New To Java...
# 8
And now despite the fact that I have not only used SET PATH and edited the Environment Variables, if I try to use the "java" command it gives"Error: could not open 'C:\Program Files\Java\jre1.2\lib\i386\jvm.cfg"'I just want to use the simple javac compile command.
aiche_aga at 2007-7-12 18:56:33 > top of Java-index,Java Essentials,New To Java...
# 9
Sorry. I hadn't read that last post.Thanks, the compiler finally did work. I just was looking in the JRE folder.
aiche_aga at 2007-7-12 18:56:33 > top of Java-index,Java Essentials,New To Java...
# 10

I dont know your reason for keeping multiple versions of Java on your machine but if you do that then you will have to make sure that you invoke the correct version of Java and the best way to do it is either through Ant scripting or by just manually typing in the commands like I recommended in my last post.

Just to make it clear (if you dont know already), javac.exe is the Java Compiler and java.exe is used to run the compiled classes.They are not interchangable.

DarumAa at 2007-7-12 18:56:33 > top of Java-index,Java Essentials,New To Java...
# 11

This isn't really as big of a deal, but...

I just got SDK 5 for use in a new program (I'm an idiot, I know) so that I can delete the other two packages.

I just edited the Enviroment Variables setting a path and class path.

Now in command prompt, I can run javac without specifying the path (just typing javac) using the SDK 5.

However, when I try to run "java.exe" and execute the program, the command prompt wants to continue to reference the old jdk I had.

How can I make the SDK the default for java.exe?

aiche_aga at 2007-7-12 18:56:33 > top of Java-index,Java Essentials,New To Java...
# 12
PATH variable works for both javac and java. Check your PATH to see if there is any reference to the old jdk/jre and delete that. It should work.Message was edited by: DarumA
DarumAa at 2007-7-12 18:56:33 > top of Java-index,Java Essentials,New To Java...