Problem in Executing a JAR file
In my project, I imported some packages from another project's class
folder. That class folder is available in my CLASSPATH and while executing my project from ECLIPSE editor, It's working well.
But, when I make it as a jar file and execute that in another machine, It throws an error "noClassDefFound", that class
belongs to another project, which I imported in my project.
That project contains Thousands of classes. But, I am using only few classes from that.
Can anyone please tell me, how to add those classes in to my jar file. And make my jar file flexible to execute at anywhere.
Thanks in advance.
--Kumaran
[671 byte] By [
_Kumarana] at [2007-11-26 19:23:18]

Thank you very much for your reply. I implemented the genjar in my project. But, while build my project, I am getting the following error.
========================================================
[genjar] Generating jar: E:\JMax\JMax.jar
BUILD FAILED
E:\JMax\build.xml:61: Unable to resolve: com/eg/util/FileWatcher.class
=========================================================
FileWatcher is my main class file.
My build.xml file is,
<?xml version="1.0"?>
<!DOCTYPE project []>
<project name="JUtar" basedir="." default="all">
<target name="init">
<property name="mainClass" value="com.eg.util.FileWatcher" />
</target>
<target name="jar" depends="init">
<genjar jarfile="JUtar.jar">
<class name="${mainClass}" />
</genjar>
</target>
</project>
Could you please help me to solve this issue..
Thanks in advance.
--Kumaran
You need to add a classpath section telling genjar where the roots of your classes may come from
<classpath>
<path refid="classes.classpath"/>
</classpath>
Which assumes the presense some where else of a path definition like
<path id="classes.classpath">
<pathelement location="${jar.home}/ajaryouuse.jar"/>
<pathelement location="${jar.home}/anotherjaryouuse.jar"/>
</path>