Skip to main content

How to set up my eclipse project to build a jar file from two jar files

1 reply [Last post]
Joined: 2008-11-13

I use eclipse 3.4.1 on FC6 linux.
My java source layouts are as follows:

My workspace is at:

My build instructions are:
cd /home/twong/java/myjar
javac -classpath ibmpkcs.jar -d . /*.java com/mycomp/cptx/*.java
jar -cf myjar.jar com/mycomp/crypto/*.class
jar -cf myjarx.jar com/mycomp/cptx/*.class

myjar.jar and myjarx.jar are used to build myProc.jar.
cd /home/twong/java/myProc
javac -d . myProc/*.java
jar -cfm myProc.jar myProc/*.class

This is the command to run my application:
java -jar /home/twong/eclipseworkspace/myProc.jar

What is the best way to set up my project to build myProc.jar from myjar.jar and myjarx.jar?

I setup my eclipse project to build the /home/twong/eclipseworkspace/myProc.jar file.
I build myjar.jar and myjarx.jar on bash.
Running myProc.jar in debug mode has the "source not found" error for the source code of myjar.jar and myjarx.jar.
How to fix it?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2008-08-28

If you use Eclipse, using bash is somewhat odd.
To run or debug your app on Eclipse, make sure that jars are included in the .classpath file.