You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by vijayaratha vijayasingam <vi...@gmail.com> on 2012/04/02 07:09:42 UTC

How to avoid long classpath issue in windows

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

Re: How to avoid long classpath issue in windows

Posted by vijayaratha vijayasingam <vi...@gmail.com>.
Hi Jarek;
Thanks for the help..
I fixed it using *"Manifestclasspath task"*, which is used to avoid long
classpath issue...
I have written a small blog[1] entry with the sample for others reference..

http://vvratha.blogspot.com/2012/04/avoiding-long-classpath-issue-in-ant.html

Thanks
-Ratha
On 2 April 2012 16:51, Jarek Czekalski <ja...@poczta.onet.pl> wrote:

>
>
> W dniu 2012-04-02 12:21, vijayaratha vijayasingam pisze:
>
>  Actually i want to know how can i correct my build.xml or what is the
>> issue
>> with it?
>>
> Use unjar task to unpack the jars.
>
>  pathing.jar contains the manifest file where the classpaths are defined
>> ..But ANT couldn't load it with the pathid "javac.classpath"..
>>
> So it will help you at runtime. Probably you won't need any repackaging
> and you will be able to run your jar using proper manifest file. But now
> you have problems with compilation and manifest file won't help you here.
>
>  Any issue with the script?
>>
> I guess not, it's the issue with java command line.
>
> Jarek
>
>> Thanks
>> -Ratha
>>
>> On 2 April 2012 15:47, Jarek Czekalski<ja...@poczta.onet.pl>>
>>  wrote:
>>
>>  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<http://ant.apache.org/manual/**Tasks/jar.html>
>>>> <http://ant.**apache.org/manual/Tasks/jar.**html<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<vijayaratha@**gma**
>>>> il.com <ht...@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-unsubscribe@ant.apache.****org<
>>> user-unsubscribe@ant.**apache.org <us...@ant.apache.org>>
>>>
>>> For additional commands, e-mail: user-help@ant.apache.org
>>>
>>>
>>>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.**org<us...@ant.apache.org>
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Re: How to avoid long classpath issue in windows

Posted by Jarek Czekalski <ja...@poczta.onet.pl>.

W dniu 2012-04-02 12:21, vijayaratha vijayasingam pisze:
> Actually i want to know how can i correct my build.xml or what is the issue
> with it?
Use unjar task to unpack the jars.
> pathing.jar contains the manifest file where the classpaths are defined
> ..But ANT couldn't load it with the pathid "javac.classpath"..
So it will help you at runtime. Probably you won't need any repackaging 
and you will be able to run your jar using proper manifest file. But now 
you have problems with compilation and manifest file won't help you here.
> Any issue with the script?
I guess not, it's the issue with java command line.

Jarek
> Thanks
> -Ratha
>
> On 2 April 2012 15:47, Jarek Czekalski<ja...@poczta.onet.pl>  wrote:
>
>> 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<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<vi...@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-unsubscribe@ant.apache.**org<us...@ant.apache.org>
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>

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


Re: How to avoid long classpath issue in windows

Posted by vijayaratha vijayasingam <vi...@gmail.com>.
Actually i want to know how can i correct my build.xml or what is the issue
with it?
pathing.jar contains the manifest file where the classpaths are defined
..But ANT couldn't load it with the pathid "javac.classpath"..
Any issue with the script?

Thanks
-Ratha

On 2 April 2012 15:47, Jarek Czekalski <ja...@poczta.onet.pl> wrote:

> 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<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<vi...@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-unsubscribe@ant.apache.**org<us...@ant.apache.org>
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Re: How to avoid long classpath issue in windows

Posted by Jarek Czekalski <ja...@poczta.onet.pl>.
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<vi...@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-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: How to avoid long classpath issue in windows

Posted by vijayaratha vijayasingam <vi...@gmail.com>.
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 <vi...@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
>