Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2006

Tip: Looking for answers? Try searching our database.

create jar file with external jar library

Thread view: 
Luigi - 31 May 2006 18:21 GMT
Hi,
in my application there are several import from an external library, in
Eclipse i've added this library in Project -> Properties -> Java Build
Path -> Add External JARs.

Well, when i export as a Jar file this "jade.jar" library is not in my jar
file and the application cannot run.

I've tried even to manually modify the manifest.mf file adding the row:
Class-Path: jade.jar (adding even the file in the jar)... but this is not a
solution

Is there a solution?
SpaceAgeJuliet@gmail.com - 31 May 2006 18:24 GMT
are you trying to export your code, with an library attached?
i do not know of a way to do this.

Perhaps you can just import the jar file as classes (unpack with
something like winzip and add the workspace as if it was your code
package), and then it will create a jar with all the code in it.

would that work around solve your problem?

> Hi,
> in my application there are several import from an external library, in
[quoted text clipped - 9 lines]
>
> Is there a solution?
Luigi - 31 May 2006 18:50 GMT
there are a lot af classes to add in this way, i hope in a more feasible
solution, but if this is the only one...

Thx

> are you trying to export your code, with an library attached?
> i do not know of a way to do this.
[quoted text clipped - 20 lines]
>>
>> Is there a solution?
IchBin - 31 May 2006 20:12 GMT
> Hi,
> in my application there are several import from an external library, in
[quoted text clipped - 9 lines]
>
> Is there a solution?

I never include Jar files in my exported jar file.  I just run my main
jar with the classpath including all of the external jar files.

Ex...
javaw -classpath
..\lib\foxtrot.jar;..\lib\forms-1.0.6.jar;..\lib\looks-2.0.jar;..\lib\metouia.jar;..\lib\kunststoff.jar;..\lib\gtkswing.jar;..\lib\quaqua.jar;..\lib\hsqldb.jar;..\lib\JQuotesApp.jar
weconsultants.org.jquotesapp.JQuotesAppManager

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor,  Regular Guy (1952-)
Martin Gerner - 01 Jun 2006 12:35 GMT
> Hi,
> in my application there are several import from an external library,
[quoted text clipped - 9 lines]
>
> Is there a solution?

If you are using Eclipse, check out FatJar. It solved my (identical)
problem.
http://fjep.sourceforge.net/

Signature

Martin Gerner

hawat.thufir@gmail.com - 01 Jun 2006 23:39 GMT
> Hi,
> in my application there are several import from an external library, in
[quoted text clipped - 9 lines]
>
> Is there a solution?

here's some stuff I did a while back:

[thufir@arrakis bin]$
[thufir@arrakis bin]$
[thufir@arrakis bin]$ date
Tue Aug  2 08:56:50 IST 2005
[thufir@arrakis bin]$ ll
total 16
-rw-rw-r--  1 thufir thufir 2511 Aug  2 08:49 ControlTidy.jar
drwxrwxr-x  2 thufir thufir 4096 Aug  2 08:55 lib
[thufir@arrakis bin]$ ll lib/
total 156
-rw-rw-r--  1 thufir thufir 147859 Aug  2 08:54 Tidy.jar
[thufir@arrakis bin]$ jar -tf ControlTidy.jar
META-INF/
META-INF/MANIFEST.MF
atreides/
atreides/tidyXhtml/
atreides/tidyXhtml/BasicTidy.class
atreides/tidyXhtml/ControlTidy.class
atreides/tidyXhtml/Test16.class
[thufir@arrakis bin]$ jar -xf ControlTidy.jar
[thufir@arrakis bin]$ ll
total 32
drwxrwxr-x  3 thufir thufir 4096 Aug  2 08:57 atreides
-rw-rw-r--  1 thufir thufir 2511 Aug  2 08:49 ControlTidy.jar
drwxrwxr-x  2 thufir thufir 4096 Aug  2 08:55 lib
drwxrwxr-x  2 thufir thufir 4096 Aug  2 08:57 META-INF
[thufir@arrakis bin]$ cat META-INF/MANIFEST.MF -n
    1  Manifest-Version: 1.0
    2  Ant-Version: Apache Ant 1.6.4
    3  Created-By: 1.5.0_02-b09 (Sun Microsystems Inc.)
    4  Main-Class: atreides.tidyXhtml.ControlTidy
    5  Built-on: 2005-08-02T08:49:14
    6  Class-Path: lib/Tidy.jar
    7
[thufir@arrakis bin]$ java -jar ControlTidy.jar
[thufir@arrakis bin]$ ll
total 100
drwxrwxr-x  3 thufir thufir  4096 Aug  2 08:57 atreides
-rw-rw-r--  1 thufir thufir  2511 Aug  2 08:49 ControlTidy.jar
-rw-rw-r--  1 thufir thufir 16083 Aug  2 08:58 err.txt
drwxrwxr-x  2 thufir thufir  4096 Aug  2 08:55 lib
drwxrwxr-x  2 thufir thufir  4096 Aug  2 08:57 META-INF
-rw-rw-r--  1 thufir thufir 42366 Aug  2 08:58 out.txt
[thufir@arrakis bin]$ date
Tue Aug  2 08:58:09 IST 2005
[thufir@arrakis bin]$

Note line 4 of the manifest, sets the Main-Class and line 6, which sets
the class-path for a needed external jar file.

As to editing a manifest manually, I'd use Ant to do that automagically
instead.

HTH,

Thufir


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.