Results 1 to 20 of 22
Thread: ===javac error===
- 12-05-2009, 11:37 AM #1
Member
- Join Date
- Dec 2009
- Posts
- 12
- Rep Power
- 0
===javac error===
after install jdk
set path=C:\Program Files\Java\jdk1.6.0_17\bin
set classpath=C:\Program Files\Java\jdk1.6.0_17\lib\tools.jar;C:\Program Files\Java\jdk1.6.0_17\lib\dt.jar
when i typed "javac" in command line ,shows the following error:
C:\Documents and Settings\Administrator>javac
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/tools/javac/Main
used 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)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: com.sun.tools.javac.Main. Program will exit.
i compile java file,it also show the error above
but when i enter "java",it works
- 12-05-2009, 12:01 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,408
- Blog Entries
- 7
- Rep Power
- 17
Get rid of that classpath; javac (as well as java and javaw) are native executable files and they know where to find the core classes.
kind regards,
Jos
- 12-05-2009, 01:17 PM #3
Member
- Join Date
- Dec 2009
- Posts
- 12
- Rep Power
- 0
i try it as you said ,but it doesn't work
same error
- 12-05-2009, 01:28 PM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,408
- Blog Entries
- 7
- Rep Power
- 17
- 12-05-2009, 01:33 PM #5
Member
- Join Date
- Dec 2009
- Posts
- 12
- Rep Power
- 0
- 12-05-2009, 01:39 PM #6
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,408
- Blog Entries
- 7
- Rep Power
- 17
- 12-05-2009, 01:59 PM #7
Member
- Join Date
- Dec 2009
- Posts
- 12
- Rep Power
- 0
- 12-05-2009, 02:32 PM #8
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,408
- Blog Entries
- 7
- Rep Power
- 17
Hm, next to the bin directory you'll find a lib directory; does it contain a tools.jar file? If so open it with a zip program (but don't extract anything). Can you find the class com.sun.tools.javac.Main? If that directory (or that file) isn't there your installation might be corrupted by something ...
kind regards,
Jos
- 12-05-2009, 02:38 PM #9
Member
- Join Date
- Dec 2009
- Posts
- 12
- Rep Power
- 0
- 12-05-2009, 04:09 PM #10
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,408
- Blog Entries
- 7
- Rep Power
- 17
- 12-05-2009, 04:17 PM #11
Member
- Join Date
- Dec 2009
- Posts
- 12
- Rep Power
- 0
- 12-05-2009, 04:25 PM #12
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,408
- Blog Entries
- 7
- Rep Power
- 17
- 12-05-2009, 04:32 PM #13
Member
- Join Date
- Dec 2009
- Posts
- 12
- Rep Power
- 0
- 12-05-2009, 04:47 PM #14
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,408
- Blog Entries
- 7
- Rep Power
- 17
Let me get this straight: if you type just "javac" in your bin directory you get a listing on the screen that tells you how to use the compiler and its flags, right? But if you type that same outside of your bin directory you get that exception stack trace, right?
If you use your 'search' facility in Microsoft Windows and search for "javac", what are the results?
kind regards,
Jos
- 12-05-2009, 05:02 PM #15
Member
- Join Date
- Dec 2009
- Posts
- 12
- Rep Power
- 0
- 12-05-2009, 05:20 PM #16
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,408
- Blog Entries
- 7
- Rep Power
- 17
Yes, that's what happens: if you define environment variables in your cmd they're only valid during that session (as long as that particular cmd runs) and they're gone when your cmd is gone. Use your control panel to set those environment variables permanently.
But what happened to that mysterious exception stack trace?
kind regards,
Jos
- 12-06-2009, 02:52 AM #17
Member
- Join Date
- Dec 2009
- Posts
- 12
- Rep Power
- 0
- 12-06-2009, 03:06 AM #18
Member
- Join Date
- Dec 2009
- Posts
- 12
- Rep Power
- 0
i reinstall the xp system ,and erverthing is ok
thanks for you help
- 12-06-2009, 08:53 AM #19
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,408
- Blog Entries
- 7
- Rep Power
- 17
- 12-06-2009, 08:58 AM #20
Member
- Join Date
- Dec 2009
- Posts
- 12
- Rep Power
- 0
Similar Threads
-
Error : Invalid path, \bin\javac.exe -classpath
By Ed in forum JCreatorReplies: 3Last Post: 08-14-2009, 12:57 PM -
javac?
By sardare in forum EclipseReplies: 1Last Post: 06-14-2008, 02:06 AM -
javac DOS
By rdunne in forum New To JavaReplies: 3Last Post: 01-01-2008, 11:49 AM -
Error :Invalid path, C:\Program Files\Java\j2re1.4.2_06\bin\javac.exe
By silvia in forum New To JavaReplies: 2Last Post: 07-30-2007, 08:55 AM -
Help with javaC
By Daniel in forum New To JavaReplies: 2Last Post: 07-04-2007, 02:44 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks