| Author |
java.lang.NoClassDefFoundError
|
abhishek kunal
Ranch Hand
Joined: Jul 27, 2009
Posts: 42
|
|
i am using ant command to build the project.using java sdk 1.6 14th update. while javac in is running well alone but when using ant it throws this message..
C:\javaeetutorial5\examples\web\hello2>ant
Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre6\li
b\tools.jar
Buildfile: build.xml
-pre-init:
init:
default-ear:
-pre-compile:
bpp-actual-compilation:
[echo] Compiling hello2
[echo] javaee.classpath.prefix is: c://sun//AppServer/lib
[echo] is.glassfish.v3 is: ${is.glassfish.v3}
[javac] Compiling 2 source files to C:\javaeetutorial5\examples\web\hello2\b
uild\web\WEB-INF\classes
BUILD FAILED
java.lang.NoClassDefFoundError: com/sun/tools/javac/Main (wrong name: sun/tools/
javac/Main)
Total time: 1 second
i have tried every possible and genuine value for java_home like C:\Program Files\Java\jdk1.6.0_14\; and C:\Program Files\Java\jdk1.6.0_14\bin and C:\Program Files\Java\jdk1.6.0_14\lib ...but cdnt solve the problem....
please help!!
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16680
|
|
It looks like you have classes that was compiled for a particular package and then simply moved to another package, without being recompiled.
Henry
|
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12907
|
|
|
It looks like Ant is looking in the wrong directory to find the Java compiler (it says "jre6" in the error message, but the JRE does not include the Java compiler). Do you have a JDK installed, or only a JRE? You need to install the JDK.
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
abhishek kunal
Ranch Hand
Joined: Jul 27, 2009
Posts: 42
|
|
|
yes i do have java sdk installed ...version 1.6 update 14...and it's also included(by me) in the path variable..i told earlier that, when i want to comile separately then i can compile well, but ant is not doing it with javac, may be its a problem of build.xml
|
 |
 |
|
|
subject: java.lang.NoClassDefFoundError
|
|
|