You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2010/10/14 10:52:17 UTC

DO NOT REPLY [Bug 50091] New: task referring to installed optional packages with nested fails with NoClassDefFoundError

https://issues.apache.org/bugzilla/show_bug.cgi?id=50091

           Summary: <java jar=".."> task referring to installed optional
                    packages with nested <jvmarg
                    value="-Djava.ext.dirs=.."/> fails with
                    NoClassDefFoundError
           Product: Ant
           Version: 1.8.1
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
        AssignedTo: notifications@ant.apache.org
        ReportedBy: anhalter42@gmx.net


Created an attachment (id=26174)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=26174)
sample project to illustrate the problem

testcase:
I have two classes in two jars. Both jars are located in the lib directory.
Using 
<java jar="lib/main.jar" fork="true" failonerror="false" dir=".">
    <jvmarg value="-Djava.ext.dirs=&quot;lib&quot;"/>
</java>
fails with NoClassDefFoundError

Using deprecated syntax
<java jar="lib/main.jar" jvmargs="-Djava.ext.dirs=&quot;lib&quot;" fork="true"
failonerror="false" dir="."/>
works just fine.

On Windows platform the issue doesn't occur.

Seems to be a sequencing issue when building the commandline: -Djava.ext.dirs
has to preceed the -jar option.

Attached is a sample project to illustrate the problem.

My platform: Ubuntu Linux 10.4, 2.6.32-24-generic kernel, x86_64

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 50091] task referring to installed optional packages with nested fails with NoClassDefFoundError

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=50091

--- Comment #3 from Dirk Bachmann <an...@gmx.net> 2010-10-25 08:57:53 EDT ---
OK, got it.
Works fine for me w/o quotes on both Linux and Windows.
Thanks!

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 50091] task referring to installed optional packages with nested fails with NoClassDefFoundError

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=50091

--- Comment #1 from Dirk Bachmann <an...@gmx.net> 2010-10-15 03:18:51 EDT ---
JRE version doesn't matter - happens with both 1.5.0_22 and 1.6.0_20

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 50091] task referring to installed optional packages with nested fails with NoClassDefFoundError

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=50091

Stefan Bodewig <bo...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME

--- Comment #2 from Stefan Bodewig <bo...@apache.org> 2010-10-22 10:56:49 EDT ---
the "depreacted" jvmargs attribute strips away the quotes that aren't
needed anyway.

using 

 <jvmarg value="-Djava.ext.dirs=lib"/>

things work fine (for me on Linux where the version with quotes fails).

You are setting a Java property and there is no directory called "lib" (with 
the quotes as part of the name).  On Windows different command line parsing
rules apply, that's why it works there.

If your directory cotained spaces you wouldn't need quotes either since
Ant uses a String[] version of exec() and thus the CLI won't erronously split
things.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.