This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.lang.NoClassDefFoundError

 
abhishek kunal
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 20835
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
BUILD FAILED
java.lang.NoClassDefFoundError: com/sun/tools/javac/Main (wrong name: sun/tools/
javac/Main)


It looks like you have classes that was compiled for a particular package and then simply moved to another package, without being recompiled.

Henry
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
abhishek kunal
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic