Compiler problem(repost)

I have both jdk1.2 and jdk1.1.8 on my local machine. it used to work fine. I meant if I set the path to jdk1.2\bin, I get the version1.2 compiler to compile my program.  If I set the path to jdk1.1.8\bin, I got version1.1.8 compiler.

One day I found I was unable to use jdk1.1.8 compiler, when I set the path to jdk1.1.8\bin, and simply type

C:> javac

I got the following "NoClassDefFoundError:java/util/ArrayList....etc.".
instead of a list of options I can use with the compiler.

  I re-downloaded JDK1.1.8, but the problem still exists.

  I set the path by

  set path=C:\jdk1.1.8\bin;%PATH%

  and using

   java -version

   to confirm the version.

   What is wrong? does anybody meet the same problem?

    Thanks,
embertAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
jjdunneConnect With a Mentor Commented:
Try

set classpath=c:\jdk1.1.8\lib\classes.zip;%CLASSPATH%
0
 
jjdunneCommented:
Did you set your classpath to include the classes.zip file for jdk1.1.8?  You do not need to do this for Java1.2
0
 
heyhey_Commented:
1.1 compiler does not use java.util.ArrayList, so you definitely start some other javac.exe.
0
 
embertAuthor Commented:
thanks! the compiler is working ok after I changed the order of classpath.  at first, I simply appended c:\jdk1.1.8\lib\classes.zip to the end of classpath.    and it did not work out.  here is the original setting:

..c:\jdk1.2.2\lib\tools.jar;c:\j2sdkee1.2\lib\j2ee.jar;c;\jdk1.1.8\lib\classes.zip

I guess either tools.jar or j2ee.jar causes the problem?

Ok, problem solved, thanks for help!

Thanks heyhey for your comments.
0
 
heyhey_Commented:
javac.exe in fact starts
java com.sun.javac.Main

you can find the 1.1 variant of com.sun.javac.Main.class inside classes.zip and 1.2 variant of the same class inside tools.jar.

0
All Courses

From novice to tech pro — start learning today.