Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » How to set up my eclipse project to build a jar file from two jar files
How to set up my eclipse project to build a jar file from two jar files [message #257372] Thu, 13 November 2008 16:22 Go to next message
Eclipse UserFriend
I use eclipse 3.4.1 on FC6 linux.
My java source layouts are as follows:
/home/twong/java/myjar/com/mycomp/cpt/
/home/twong/java/myjar/com/mycomp/cptx/
/home/twong/java/myProc/myProc
/home/twong/java/myProc/myProc.mf

My workspace is at:
/home/twong/eclipseworkspace

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.mf 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?
Re: How to set up my eclipse project to build a jar file from two jar files [message #257377 is a reply to message #257372] Fri, 14 November 2008 06:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: 4cs6fcg02.sneakemail.com

TsanChung schreef:
> I use eclipse 3.4.1 on FC6 linux.
> My java source layouts are as follows:
> /home/twong/java/myjar/com/mycomp/cpt/
> /home/twong/java/myjar/com/mycomp/cptx/
> /home/twong/java/myProc/myProc
> /home/twong/java/myProc/myProc.mf
>
> My workspace is at:
> /home/twong/eclipseworkspace
>
> 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.mf 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?

Do File → Export → Java → Runnable Jar file. If you want this to happen
automatically, look at the build file produced and adopt this into your
own Ant build file.

H.
--
Hendrik Maryns
http://tcl.sfs.uni-tuebingen.de/~hendrik/
==================
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
Re: How to set up my eclipse project to build a jar file from two jar files [message #257382 is a reply to message #257372] Fri, 14 November 2008 09:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

On 11/13/2008 4:22 PM, TsanChung wrote:
> I use eclipse 3.4.1 on FC6 linux.
> My java source layouts are as follows:
> /home/twong/java/myjar/com/mycomp/cpt/
> /home/twong/java/myjar/com/mycomp/cptx/
> /home/twong/java/myProc/myProc
> /home/twong/java/myProc/myProc.mf
>
> My workspace is at:
> /home/twong/eclipseworkspace
>
> 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.mf 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?

You'll have to write an small Ant script to do it and then incorporate
that script as a custom builder. See this for how to define a custom
builder:
< http://bewarethepenguin.blogspot.com/2008/08/customizing-bui lds-for-your-eclipse.html>

Hope this helps,
Eric
Re: How to set up my eclipse project to build a jar file from two jar files [message #257436 is a reply to message #257382] Tue, 18 November 2008 11:30 Go to previous message
Eclipse UserFriend
Now I use custom build script to build a jar file on eclipse 3.4.1 & FC6.
It build the first time but fail to build with this message:
Note: myProc/myProc.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

The custom build script makejar.sh is as follows:
#!/bin/bash
javac -d . myProc/*.java
jar -cfm myProc.jar myProc.mf myProc/*.class

Running the custom build script as a shell script always build the jar
file even though a warning appear.
$ ./makejar.sh
Note: myProc/myProc.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

Please help to make the custom build script always build inside eclipse.
Thanks.
Previous Topic:Changing Java Build Path deletes > 2000 files
Next Topic:cannot set breakpoint in the source jar file when debugging another jar file
Goto Forum:
  


Current Time: Fri Jul 25 17:23:32 EDT 2025

Powered by FUDForum. Page generated in 0.05215 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top