• Post Reply Bookmark Topic Watch Topic
  • New Topic

Had to install sdk 6, but getting java.lang.ClassnotFoundError: com/sun/tools/javac/main  RSS feed

 
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I had to download sdk 6 to mimic what somebody (myself) had done a few years ago. Anyways, I just downloaded sdk 6 from oracle, installed sdk to C:\JAVA6...

Went into Environment Variables

Under User variables for myself...Path...added C:\JAVA6\BIN

I get the above error. Am I missing something here? Thank you.
 
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have multiple Java versions installed? Maybe you are mixing them up in some way. What output do you get when you enter the following commands?

java -version
javac -version
 
Tom Griffith
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java version 1.7.0_25 (I'm not sure where this is mapping from, it looks like there might be an oracle client installation which is in the System path variable string)

javac -version - getting same error java.lang.NoClassDefFoundError: com/sun/tools.javac/Main
 
Tom Griffith
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After typing path on the command line, and noticing that C:\JAVA6\BIN was at the end, I went backwards through the path string (I am assuming System variables go first and take precedence), I noticed C:\Windows\system32 which is a System environment variable and is much earlier in the Path string.

there is a java.exe in that directory so I think that is why java - version returns 1.7.0_25.

Since it's only a jre, no javac.exe is in C:\Windows/system32.

But wouldn't javac just keep going through the path string until it found javac.exe, which would be under C:\JAVA6\BIN?

I guess don't see how the two environments would really be the source of this error..

but if it is, I can't mess with C:\Windows\system32, namely removing java.exe from there...or shoving javac.exe in there...


I also tried this...literally typing in the path to javac.exe...

C:\Test_Programs>C:\JAVA6\BIN\javac HelloTest.java

still receive the same error...
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a bit hard to discover why exactly you have this problem. It's possible to install multiple JDKs and JREs at the same time on the same system, and as long as they are installed in separate directories they should not interfere.

Make sure that the C:\JAVA6\BIN directory is in the PATH before the Java 7 JRE bin directory.

Did you set the CLASSPATH environment variable to anything? If so, then try to have it not set at all.
 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I uninstalled the 6 jvm and reinstalled the same version number as the jre found in c:\Windows\system32 and javac started working, so it was an issue of the two environments. I was hoping the jre and sdk wouldn't split hairs down to the update level (like JRE7_u20_update4) or something like that but it's ok now. Thank you both so much for your help.

I do have one thing lingering though, and I don't know if it will ultimately casue an issue. From Control Panel - Add Remove Programs, I managed to remove SDK 6 but it left a program called

Java (TM)6 Update 45

I get an error that Windows can't find some dll or something and it won't uninstall. It hasn't casued a problem with my javac and java stuff and I've checked startup programs to see if it's some auto-updated which uns on startup but I don't see it. I'm afraid it might cause an issue though. Does anybody have any ideas how to get rid of it?

Thank you.

 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!