On Solaris 10, I'm using JDK 1.5.0_22 and when I run any of the JDK executables (javac, native2ascii, javadoc, etc) in the JDK/bin directory that require tools.jar to run, I get this error (run with and without arguments):
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/tools/javac/Main
JRE executables in the bin directory which do not require tools.jar work fine (java, keytool, etc)
Yes, tools.jar is located in the JDK/lib directory, and the permissions are OK and it's not corrupt - I am able to view contents of tools.jar and extract them.
I have tried setting JAVA_HOME, and adding the JDK/bin directory to PATH - setting/unsetting these environment variables makes no difference. I still get the same error.
This is the only thing I have found that does get rid of the NoClassDefFoundError and allow the JDK/bin executable to run (cmd below is run from the JDK/bin directory): ./native2ascii -J-Xbootclasspath/a:../lib/tools.jar
So if I add '-J-Xbootclasspath/a:../lib/tools.jar' to any JDK/bin executable like javac, javadoc, native2ascii, they run. Otherwise, they do not.
Any ideas on how to fix? All of the JDK/bin executables run fine on other Solaris 10 systems I have, and none of them have any JAVA_HOME vars set or JDK/bin on the PATH.