Im trying to execute my java program using ant build script in windows environment.
But im getting following issue. This is working in linux environment.
[1] init: compile: stockquote: [java] C:\wso2esb-4.0.0-SNAPSHOT\samples\axis2Client\build.xml:128: java.io.IOException: Cannot run program "C:\Program Files\Java\jdk1.6.0_20\jr e\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 parameter 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)
<target name="stockquote" depends="compile">
<java classname="samples.userguide.StockQuoteClient"
classpathref="javac.classpath" fork="true">
<sysproperty key="symbol" value="${symbol}"/>
<sysproperty key="mode" value="${mode}"/>
<sysproperty key="addurl" value="${addurl}"/>
-----------------------------------------------
<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>
Seems like your CLASSPATH is too long for Windows to cope with.
Google for "CreateProcess error=87, The parameter is incorrect". See also this answer.
You will need to shorten your classpath. Try to include only the actual dependencies of StockQuoteClient and nothing else, rather than all the "*.jar" entries.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With