B
bill turner
I have been away from java for awhile and never spent much time with
it. I am having what is a very basic problem that I have not been able
to resolve. I am trying to include a jar from one project into the
classpath of another project. My directory structure is as follows:
src - my source files
class - my class files
lib - external jars, zips to be used by this project (currently my jar
from the other project - util)
jar - my generated jar file
make - build.xml and manifest file
i have tried running both via cygwin bash and dos. The results below
are from the cygwin bash execution (the dos results are identical). The
java.lang.NoClassDefFoundError exception is for a class within the
util.jar, the included jar, not jequire.jar, my current project.
/home/Wizard/bin>sh jequire.sh
Exception in thread "main" java.lang.NoClassDefFoundError:
com/changent/util/ui/ButtonPanel
at
com.changent.jequire.JequireTabs.makeTypeTabs(JequireTabs.java:33)
at com.changent.jequire.JequireTabs.<init>(JequireTabs.java:25)
at com.changent.jequire.Jequire.<init>(Jequire.java:48)
at com.changent.jequire.Jequire.main(Jequire.java:115)
The bash script for executing this is:
#!/usr/bin/bash
cd ${HOME}/jequire
export CLASSPATH=
$JAVA_HOME/bin/java -jar jar/jequire.jar
I realize the classpath should be taken from the manifest. The manifest
from jequire.jar looks like:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.5
Created-By: 1.5.0_07-b03 (Sun Microsystems Inc.)
Built-By: Wizard
Main-Class: com/changent/jequire/Jequire
Class-Path: util.jar
My ant script (I am not strong with ant, either), looks like:
<target name="jar_java" depends="compile_java" description="Create
${ant.project.name}.jar java file" >
<manifest file="MANIFEST.MF">
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Main-Class"
value="com/changent/jequire/Jequire"/>
<attribute name="Class-Path" value="util.jar" />
</manifest>
<jar destfile = "${jar}/${ant.project.name}.jar"
manifest="MANIFEST.MF">
<fileset dir="${class}"
excludes="**/*.tws"
/>
<fileset dir="${lib}" />
</jar>
</target>
The resultant jar has all the jequire classes, as would be expected,
the manifest, and the util.jar with no path info. I do not know what I
am doing wrong. Should I change the ant script somehow? The way the jar
is executed? Or something else?
Your help is greatly appreciated!
it. I am having what is a very basic problem that I have not been able
to resolve. I am trying to include a jar from one project into the
classpath of another project. My directory structure is as follows:
src - my source files
class - my class files
lib - external jars, zips to be used by this project (currently my jar
from the other project - util)
jar - my generated jar file
make - build.xml and manifest file
i have tried running both via cygwin bash and dos. The results below
are from the cygwin bash execution (the dos results are identical). The
java.lang.NoClassDefFoundError exception is for a class within the
util.jar, the included jar, not jequire.jar, my current project.
/home/Wizard/bin>sh jequire.sh
Exception in thread "main" java.lang.NoClassDefFoundError:
com/changent/util/ui/ButtonPanel
at
com.changent.jequire.JequireTabs.makeTypeTabs(JequireTabs.java:33)
at com.changent.jequire.JequireTabs.<init>(JequireTabs.java:25)
at com.changent.jequire.Jequire.<init>(Jequire.java:48)
at com.changent.jequire.Jequire.main(Jequire.java:115)
The bash script for executing this is:
#!/usr/bin/bash
cd ${HOME}/jequire
export CLASSPATH=
$JAVA_HOME/bin/java -jar jar/jequire.jar
I realize the classpath should be taken from the manifest. The manifest
from jequire.jar looks like:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.5
Created-By: 1.5.0_07-b03 (Sun Microsystems Inc.)
Built-By: Wizard
Main-Class: com/changent/jequire/Jequire
Class-Path: util.jar
My ant script (I am not strong with ant, either), looks like:
<target name="jar_java" depends="compile_java" description="Create
${ant.project.name}.jar java file" >
<manifest file="MANIFEST.MF">
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Main-Class"
value="com/changent/jequire/Jequire"/>
<attribute name="Class-Path" value="util.jar" />
</manifest>
<jar destfile = "${jar}/${ant.project.name}.jar"
manifest="MANIFEST.MF">
<fileset dir="${class}"
excludes="**/*.tws"
/>
<fileset dir="${lib}" />
</jar>
</target>
The resultant jar has all the jequire classes, as would be expected,
the manifest, and the util.jar with no path info. I do not know what I
am doing wrong. Should I change the ant script somehow? The way the jar
is executed? Or something else?
Your help is greatly appreciated!