To avoid the long class path issue in windows, i modified my build.xml like[1]
introduced a property called “temp” and referring that from “path location”
But now im getting “Class not found” exception[2].
How can i correct my script?
If i don’t use the “temp” property and try to read “temp.classpath” as my “javac” classpath” i get long classpath issue..(That is why i introduced that property and made “javac” path as “javac.classpath”)
[1]
<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>
[2]
init:
compile:
stockquote:
[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)
In ANT to avoid long classpath issue there is ManifestClasspath task available ..I used that and now it is working properly in windows and linux..
I have written a blog[1] entry here with the sample..If anyone find it useful..
http://vvratha.blogspot.com/2012/04/avoiding-long-classpath-issue-in-ant.html