Stop data retention! Click here & act! Are you a webmaster and want to participate? Here you can find all necessary material for your website - Willst du auch an der Aktion teilnehmen? Hier findest du alle relevanten Infos und Materialien:
Chris Karakas Online Forum Index Karakas Online
 FAQFAQ   Forum SearchForum Search   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
NoClassDefFoundError: org/apache/tools/ant/launch/Launcher



 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
   Chris Karakas Online Forum Index -> Java Forum RSS Feed of this Forum
Share this page: These icons link to social bookmarking sites where readers can share and discover new web pages.Digg  del.icio.us  tc.eserver.org  Blinklist  Furl  Reddit  Blogmarks  Magnolia  Sphere  Yahoo!  Google  Windows Live  Technorati  Blue Dot  Simpy  Newsvine  Stumble Upon  co.mments.com  Blinkbits  BlogMemes  Connotea  View previous topic :: View next topic  
Author Message
chris
Dark Lord of the Sith


Joined: 10 May 2003
Posts: 6267
Location: Outer Space

PostPosted: Mon Jul 23, 2007 11:06 pm    Post subject: NoClassDefFoundError: org/apache/tools/ant/launch/Launcher
Reply with quote

Question Problem: You run ant and get the funky error:

Code:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher


I have ant 1.6.x. The CLASSPATH variable is not set, so this is NOT a problem caused by some other (older) ant being in the class path somewhere.

Running

Code:

ant --noconfig -version


also brings up the same error:

Code:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher


Question Reason: Only running

Code:

ant --execdebug


shed some light in what ant was expecting to find and where:

Code:

exec "/usr/lib/java/bin/java" -classpath "/usr/bin/build-classpath: error: JVM_LIBDIR -exports/usr does not exist or is not a directory:/usr/bin/build-classpath: error: JVM_LIBDIR -exports/usr does not exist or is not a directory:/usr/lib/java/lib/tools.jar" -Dant.home="/usr/share/ant" -Dant.library.dir="/usr/share/ant/lib" org.apache.tools.ant.launch.Launcher -cp ""
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher


The important thing here is:

Code:

/usr/bin/build-classpath: error: JVM_LIBDIR -exports/usr does not exist or is not a directory


Looking at the code of /usr/bin/build-classpath does not reveal any use of JVM_LIBDIR.
However, /usr/bin/build-classpath includes /usr/share/java-utils/java-functions, which
indeed builds JVM_LIBDIR from a variable called JVM_ROOT:

Code:

set_jvm_dirs() {
    # Jar repository provided by the JVM
    JVM_LIBDIR=$JVM_ROOT-exports/$(echo "$JAVA_HOME" |\
        sed -n "s+$JVM_ROOT/\([-[:alnum:].]*\)\(.*\)+\1+p")


and a bit further down:

Code:

    if [ ! -d "$JVM_LIBDIR" ]; then
        echo "$0: error: JVM_LIBDIR $JVM_LIBDIR does not exist or is not a directory"
        return 1


So the error

Code:

JVM_LIBDIR -exports/usr does not exist or is not a directory


comes from that place and indicates tha the $JVM_ROOT variable is simply empty.

Nowhere in /usr/share/java-utils/java-functions did it say that it needs a correctly set $JVM_ROOT variable, although it does say:

Code:

# Set JVM-related directories
# Requires a correct $JAVA_LIBDIR, $JAVA_HOME and $JAVA_CMD


Rolling Eyes

Arrow Solution: Adding the line:

Code:

JVM_ROOT=/usr/lib/jvm


to my /etc/java/java.conf

solved the problem.
_________________
Regards

Chris Karakas
www.karakas-online.de
Back to top
View user's profile Send private message Send e-mail Visit poster's website
chris
Dark Lord of the Sith


Joined: 10 May 2003
Posts: 6267
Location: Outer Space

PostPosted: Mon Jul 23, 2007 11:32 pm    Post subject:
Reply with quote

If you install Java 1.6, the SuSE RPMs will tell you they need jpackage-utils of version at least 1.7. Installing package jpackage-utils-1.7.0-19 will update, among others, the /usr/share/java-utils/java-functions file, leading to new errors when you run ant:

Code:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher


Again, only

Code:

ant --execdebug


will show you where the problem really lies:

Code:

ant --execdebug

exec "/usr/lib/java/bin/java" -classpath "/usr/bin/build-classpath: error: JAVAVER_LIBDIR /usr/share/java-1.6.0 does not exist or is not a directory:/usr/bin/build-classpath: error: JAVAVER_LIBDIR /usr/share/java-1.6.0 does not exist or is not a directory:/usr/lib/java/lib/tools.jar" -Dant.home="/usr/share/ant" -Dant.library.dir="/usr/share/ant/lib" org.apache.tools.ant.launch.Launcher -lib ""

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher


So this time it is JAVAVER_LIBDIR, a new constant in the Pandorra box of Java constants, that points to something non-existent. Rolling Eyes

Just like in C most of the time I spend compiling a program, I spend it trying to tell the configure script where to find the right header files, most time I spend in Java trying to get a program to run, I spend it trying to set or find the right class paths, library directories and the like... Mad

Arrow Solution: This time I set a symlink:

Code:

ln -s /usr/share/java /usr/share/java-1.6.0


and the problem went away again - till the next upgrade of jpackage-utils. Rolling Eyes
_________________
Regards

Chris Karakas
www.karakas-online.de
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Share this page: These icons link to social bookmarking sites where readers can share and discover new web pages.Digg  del.icio.us  tc.eserver.org  Blinklist  Furl  Reddit  Blogmarks  Magnolia  Sphere  Yahoo!  Google  Windows Live  Technorati  Blue Dot  Simpy  Newsvine  Stumble Upon  co.mments.com  Blinkbits  BlogMemes  Connotea 
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
   Chris Karakas Online Forum Index -> Java Forum
Page 1 of 1
This page contains valid HTML 4.01 Transitional - click here to check it!
This page contains a valid CSS - click here to check it!

 

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group