You could unpack part of the jars and use the directory containing classes as a classpath. Later you may put them into a single jar. For compilation it's safe. For distribution there may be licensing issues, depending on the libraries involved.

Jarek

W dniu 2012-04-02 11:47, vijayaratha vijayasingam pisze:
I corrected my build.xml as follows according the following doc
http://ant.apache.org/manual/Tasks/jar.html
Where I just introduced a new jar(pathing.jar) which mainly contains a
manifest file where i define all classpaths..But still i get CNF issue..
Any idea how can i overcome this issue?

     <target name="init">
         <mkdir dir="${class.dir}"/>
         <mkdir dir="./../../work/temp/sampleClient"/>
           <path id="javac.classpath">
             <pathelement path="${class.dir}"/>
             <pathelement path="../../lib"/>
             <pathelement
location="../../samples/axis2Client/pathing.jar"/>
         </path>
     </target>

  <jar destfile="pathing.jar">
   <manifest>
     <attribute name="Class-Path"
value="../../repository/components/lib/*.jar
../../repository/components/extensions/*.jar
../../repository/components/plugins/*.jar ../../lib/*.jar
../../lib/endorsed/*.jar"/>
   </manifest>
</jar>

     <target name="compile" depends="init" description="Compile all
Java">
         <javac srcdir="src" destdir="${class.dir}"
includeantruntime="false">
             <classpath refid="javac.classpath"/>
         </javac>
     </target>


On 2 April 2012 10:39, vijayaratha vijayasingam<vijayara...@gmail.com>wrote:

Hi all;
Im facing a long classpath issue in windows with my build.xml.
If i  define the build.xml as follows[1], im getting long classpath
issue[2]

[1]<target name="init">
         <mkdir dir="${class.dir}"/>
         <mkdir dir="./../../work/temp/sampleClient"/>
           <path id="javac.classpath">
             <pathelement path="${class.dir}"/>
             <pathelement path="../../lib"/>
             <fileset
dir="../../repository/components/plugins">
                 <include name="*.jar"/>
             </fileset>
             <fileset dir="../../lib">
                 <include name="*.jar"/>
             </fileset>
             <fileset dir="../../lib/endorsed">
                 <include name="*.jar"/>
             </fileset>
             <fileset dir="../../repository/components/extensions">
                 <include name="*.jar"/>
             </fileset>
             <fileset dir="../../repository/components/lib">
                 <include name="*.jar"/>
             </fileset>
         </path>

     </target>

     <target name="compile" depends="init" description="Compile all
Java">
         <javac srcdir="src" destdir="${class.dir}"
includeantruntime="false">
             <classpath refid="javac.classpath"/>
         </javac>
     </target>

[2}

\build.xml:128: java.io.IOException: Cannot run program "C:\Program
Files\Java\jdk1.6.0_20\jr
\bin\java.exe": CreateProcess error=87, The parameter is incorrect
     [java]     at org.apache.tools.ant.taskdefs.Java.fork(Java.java:798)
     [java]     at
org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:214)
     [java]     at
org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:135)
     [java]     at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108)
     [java]     at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
     [java]     at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown
Source)
     [java]     at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     [java]     at java.lang.reflect.Method.invoke(Method.java:597)
     [java]     at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
     [java]     at org.apache.tools.ant.Task.perform(Task.java:348)
     [java]     at org.apache.tools.ant.Target.execute(Target.java:390)
     [java]     at org.apache.tools.ant.Target.performTasks(Target.java:411)
     [java]     at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
     [java]     at
org.apache.tools.ant.Project.executeTarget(Project.java:1368)
     [java]     at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
     [java]     at
org.apache.tools.ant.Project.executeTargets(Project.java:1251)
     [java]     at org.apache.tools.ant.Main.runBuild(Main.java:809)
     [java]     at org.apache.tools.ant.Main.startAnt(Main.java:217)
     [java]     at
org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
     [java]     at
org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
     [java] Caused by: java.io.IOException: Cannot run program "C:\Program
Files\Java\jdk1.6.0_20\jre\bin\java.exe": CreateProcess error=87, The param
ter is incorrect
     [java]     at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
     [java]     at java.lang.Runtime.exec(Runtime.java:593)
     [java]     at
org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:862)
     [java]     at
org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:481)
     [java]     at
org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:495)
     [java]     at org.apache.tools.ant.taskdefs.Java.fork(Java.java:791)
     [java]     ... 19 more
     [java] Caused by: java.io.IOException: CreateProcess error=87, The
parameter is incorrect
     [java]     at java.lang.ProcessImpl.create(Native Method)


To avoid this in introduced a property and tried to pass that as javac
classpath as follows[3]; But now im getting class not found exception[4]
  I  would really appreciate any help on this long class path issue..

[3]<target name="init">
         <mkdir dir="${class.dir}"/>
         <mkdir dir="./../../work/temp/sampleClient"/>
           <path id="temp.classpath">
             <pathelement path="${class.dir}"/>
             <pathelement path="../../lib"/>
             <fileset
dir="../../repository/components/plugins">
                 <include name="*.jar"/>
             </fileset>
             <fileset dir="../../lib">
                 <include name="*.jar"/>
             </fileset>
             <fileset dir="../../lib/endorsed">
                 <include name="*.jar"/>
             </fileset>
             <fileset dir="../../repository/components/extensions">
                 <include name="*.jar"/>
             </fileset>
             <fileset dir="../../repository/components/lib">
                 <include name="*.jar"/>
             </fileset>
         </path>
  <property name="temp" refid="temp.classpath" />
         <path id="javac.classpath">
             <pathelement location="${temp}"/>
         </path>

     </target>

     <target name="compile" depends="init" description="Compile all
Java">
         <javac srcdir="src" destdir="${class.dir}"
includeantruntime="false">
             <classpath refid="javac.classpath"/>
         </javac>
     </target>

[4]  [java] java.lang.NoClassDefFoundError:
samples/userguide/StockQuoteClient
  [java] Caused by: java.lang.ClassNotFoundException:
samples.userguide.StockQuoteClient
  [java]     at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
  [java]     at java.security.AccessController.doPrivileged(Native Method)
  [java]     at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
  [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
  [java]     at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
  [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
  [java] Could not find the main class:
samples.userguide.StockQuoteClient.  Program will exit.
  [java] Exception in thread "main"
  [java] Java Result: 1


Thanks
-Ratha


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to