views:

203

answers:

2

OpenSolaris 2009.6 does not come with a javac. So I installed the SUNWj6dvx package. It installed a javac alright, but when i run the javac, I got this error message:

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/tools/javac/Main
Caused by: java.lang.ClassNotFoundException: com.sun.tools.javac.Main
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: com.sun.tools.javac.Main.  Program will exit.

I suspect it is a JAVA_HOME issue, but I cannot find any directory under /usr/jdk that contains a tool.jar.

Did I install the right package? If so, what should the proper JAVA_HOME path?

A: 

Check where rt.jar and tools.jar are

find / -name rt.jar
find / -name tools.jar

Check what value JAVA_HOME has.

Is this a 64-bit install? Then you need to install the 32-bit version as well.

jitter
+1  A: 

You most likely need additional packages which is not exactly easy to do right with OpenSolaris.

The easiest way to get everything running is most likely to use "Add More Software" to install Eclipse since it pulls in the needed packages, including the complete Java 6 JDK.

I can run "javac" in a Terminal here.

Thorbjørn Ravn Andersen
It is a good suggestion.But I just found out a solution: I just need to install the following packages: pkg install SUNWj6dev SUNWj6cfg SUNWj6man SUNWj6dmo
Anthony Kong