ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 25255] New: - <jar> gets manifest wrong so classpath doesnt work for "java -jar my.jar"
Date Fri, 05 Dec 2003 22:41:46 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25255>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25255

<jar> gets manifest wrong so classpath doesnt work for "java -jar my.jar"

           Summary: <jar> gets manifest wrong so classpath doesnt work for
                    "java -jar my.jar"
           Product: Ant
           Version: 1.5.4
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: caron@unidata.ucar.edu


this is broken in 1.5.1, 1.5.4 and 1.6beta3

if i use ant's <jar> task to create a manifest (internal or external), then 
java 1.4.2 (probably others) doesnt allow java -jar my.jar

i get this error

+ java -Xmx512m -jar netcdfAll.jar
Exception in thread "main" java.lang.NoClassDefFoundError: 
ucar/util/prefs/XMLStore
at ucar.nc2.ui.ToolsUI.main(ToolsUI.java:761)

but with no other changes this works:

+ java -Xmx512m -classpath 
netcdfAll.jar;prefsAll.jar;units.jar;HTTPClient.jar;jdom.jar 
ucar.nc2.ui.ToolsUI

i can use the <exec> command with jdk's jar to get around this, so this works: 

<exec dir="${build.classes.dir}" executable="jar" output="dir.txt">
  <arg line="cfm ${dist.dir}/${jarAll.library} ${root.dir}/manifest.txt *"/>
</exec>

but this doesnt:
		
<jar jarfile="${dist.dir}/${jarAll.library}" index="true" 
manifest="${root.dir}/manifest.txt">
  <fileset dir="${build.classes.dir}" />
  <fileset dir="${build.dir}" includes="README "/>
</jar>

the only thing i can see different is where the Created-By: line gets placed 
in the manifest, which seems to be rearranged by <jar> (ive extracted the 
manifests from the jars):

$ cat manifest.bad
Manifest-Version: 1.0
Created-By: Apache Ant 1.5.1
Main-Class: ucar.nc2.ui.ToolsUI
Class-Path: prefsAll.jar HTTPClient.jar units.jar jdom.jar

$ cat manifest.good
Manifest-Version: 1.0
Class-Path: prefsAll.jar HTTPClient.jar units.jar jdom.jar
Created-By: Apache Ant 1.5.1
Main-Class: ucar.nc2.ui.ToolsUI

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message