H
harryos
I am writing some code that uses some classes from jai.
i have the following dir structure for code i am trying to compile
-src ----contains my src code(mypackage.MyCode.java)
-lib----contains jai_codec.jar,jai_core.jar
build.xml
I have set the classpath as below,and wrote targets
.....
<property name="main-class" value="mypackage.MyClass"/>
<path id="classpath">
<fileset dir="lib" includes="**/*.jar"/>
</path>
....
<target name="compile" depends="init">
<javac srcdir="src" destdir="${classes.dir}"
classpathref="classpath"/>
</target>
<target name="jar" depends="compile">
<jar destfile="${dist.dir}/mycode.jar" basedir="${classes.dir}">
<manifest>
<attribute name="Main-Class" value="${main-class}"/>
</manifest>
</jar>
</target>
<target name="run" depends="jar">
<java fork="true" classname="${main-class}">
<classpath>
<path refid="classpath"/>
<path location="${dist.dir}/mycode.jar"/>
</classpath>
</java>
</target>
.....
when i try 'ant run' from the cmd prompt i get a set of errors
starting with
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/
jai/OperationRegistrySpi ....etc
I am able to compile the code by 'ant compile' successfully..
'ant jar' too works and puts the jar file in folder 'dist'.
Is there something wrong with the ant script? Is there some way i can
echo the classpath from inside the run target sothat i can know the
runtime classpath?
can someone help?
thanks
harry
i have the following dir structure for code i am trying to compile
-src ----contains my src code(mypackage.MyCode.java)
-lib----contains jai_codec.jar,jai_core.jar
build.xml
I have set the classpath as below,and wrote targets
.....
<property name="main-class" value="mypackage.MyClass"/>
<path id="classpath">
<fileset dir="lib" includes="**/*.jar"/>
</path>
....
<target name="compile" depends="init">
<javac srcdir="src" destdir="${classes.dir}"
classpathref="classpath"/>
</target>
<target name="jar" depends="compile">
<jar destfile="${dist.dir}/mycode.jar" basedir="${classes.dir}">
<manifest>
<attribute name="Main-Class" value="${main-class}"/>
</manifest>
</jar>
</target>
<target name="run" depends="jar">
<java fork="true" classname="${main-class}">
<classpath>
<path refid="classpath"/>
<path location="${dist.dir}/mycode.jar"/>
</classpath>
</java>
</target>
.....
when i try 'ant run' from the cmd prompt i get a set of errors
starting with
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/
jai/OperationRegistrySpi ....etc
I am able to compile the code by 'ant compile' successfully..
'ant jar' too works and puts the jar file in folder 'dist'.
Is there something wrong with the ant script? Is there some way i can
echo the classpath from inside the run target sothat i can know the
runtime classpath?
can someone help?
thanks
harry