Results 1 to 7 of 7
- 12-23-2011, 09:38 PM #1
Member
- Join Date
- Oct 2011
- Location
- New Jersey
- Posts
- 44
- Rep Power
- 0
Can't run javac after installing jdk 1.6
I need to update the java on one of my server to 1.6. Everything is running fine under jdk 1.5. And I looked through most of the core code, they should work on 1.6 as well. I needed 1.6 to develop some new features. Therefore I tried to install jdk1.6 update 30. After installing and pointing the path variable, I encountered the following error when I tried to re-compile all my files:
root> javac HelloWorld.java
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(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: com.sun.tools.javac.Main. Program will exit.
I tried to install 1.6 update 26, but the problem persists. Reverting back to 1.5, javac compiles the codes properly again.
I googled up the error online, but I don't really understand most of the replies or proposed solution. The response online sees to say that this is more of a server error that relates to Tomcat and JSP? I am just a regular java programmer without too much working knowledge on either tomcat or JSP yet. Could anybody enlighten me on this error?
- 12-24-2011, 03:21 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,406
- Blog Entries
- 7
- Rep Power
- 17
Re: Can't run javac after installing jdk 1.6
Javac.exe (on a MS Windows machine) is just a small wrapper that fires up the JVM and tries to make the JVM run a Java class: com.sun.tools.javac.Main; if that wrapper succeeds (you can test it by typing 'javac YourSource.java') everything is fine. Something else tries to run that com.sun.tools.javac.Main class directly but it's looking at the wrong place; probably caused by a previous installation of your JDK and/or an incorrect environment variable setting (look for something like JAVA_HOME in your environment).
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 12-26-2011, 08:28 PM #3
Member
- Join Date
- Oct 2011
- Location
- New Jersey
- Posts
- 44
- Rep Power
- 0
Re: Can't run javac after installing jdk 1.6
Hey Jos,
Thanks for replying my question again! Some of the things you said rings some bells~
1. Versions.. The server is built in old days, we initially used java 1.4, but we installed 1.5, and then now 1.6.
So all these version are present. We simply changed all environmental var to the jdk folders..
2. JAVA_HOME.. before we did not even set such an env var.. it's only when I needed to use Ant to build .jar files, I set up Ant on the server and thus set up the ANT_HOME and JAVA_HOME env var.
for path, I set to jdk_1.6\bin , for JAVA_HOME, i set to jdk_1.6 folder.
I didn't see anything wrong with such setting..
Maybe with these details, you could direct me a bit further?
- 01-04-2012, 07:23 PM #4
Member
- Join Date
- Oct 2011
- Location
- New Jersey
- Posts
- 44
- Rep Power
- 0
Re: Can't run javac after installing jdk 1.6
Hi Jobs,
I've figured the problem already.. It seems to be an installation problem:
When I installed java 1.6 (update 26) before, I installed the JRE in the same folder as the JDK when the installation prompts me. That might have overwrote some of the essential files in the original JDK folder..
Now I just separated jre and jdk into 2 different folder and everything is back to normal.
It seems that before 1.6, i.e. the 1.5 and 1.4, you can put jre in the same folder as jdk and the java environment would be fine. I do not have a deeper understanding on this matter though.. I learned java with 1.6..
- 01-04-2012, 07:58 PM #5
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,406
- Blog Entries
- 7
- Rep Power
- 17
Re: Can't run javac after installing jdk 1.6
As far as I know, if you download and install the JDK, it installs a JRE with it. Both are installed in separate directories next to eachother.
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 01-08-2013, 02:16 PM #6
Member
- Join Date
- Jan 2013
- Posts
- 1
- Rep Power
- 0
- 01-08-2013, 02:51 PM #7
Similar Threads
-
Installing JDK 1.5
By raahul456 in forum New To JavaReplies: 7Last Post: 09-03-2009, 11:50 AM -
HELP installing JDK please!
By trucutru in forum New To JavaReplies: 9Last Post: 01-17-2009, 06:31 AM -
Help with JExcel installing
By Webuser in forum New To JavaReplies: 0Last Post: 12-02-2008, 05:55 AM -
installing j2s
By ravjot28 in forum EclipseReplies: 9Last Post: 06-27-2008, 11:10 AM -
Installing JMF
By vinnieza in forum EclipseReplies: 0Last Post: 05-04-2008, 07:11 PM


LinkBack URL
About LinkBacks


Bookmarks