Skip to main content



      Home
Home » Newcomers » Newcomers » Exporting libraries to jar file?
Exporting libraries to jar file? [message #249155] Mon, 18 February 2008 03:51 Go to next message
Eclipse UserFriend
Originally posted by: Abel.MacAdam.eden.invalid

Hi,

How do you instruct Eclipse to export libraries you used while developing?

When I try to start my Applet I get the following error in my Java Console:
java.lang.NoClassDefFoundError: org/apache/log4j/Logger

When I check the contents of my jar file I see that indeed, no
log4j-1.2.15.jar entry exists in the jar file I created while exporting my
result.

I checked the Eclipse (Europa) help file, and thought I need to set what I
export from my project in the 'Java Build Path'. If I understand
correctly, I need to select the jar files I want to export in the 'Order
and Export' tab of the 'Java Build Path' window. That I did. But the
log4j-1.2.15.jar file is not included in the export result. What am I
missing?

TIA,
Abel
Re: Exporting libraries to jar file? [message #249167 is a reply to message #249155] Mon, 18 February 2008 06:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Abel.MacAdam.eden.invalid

As an alternative, I'm using the jar facility on the command prompt. And
although I can now verify that I have the log4j-1.2.15.jar file in my jar
file, I still get the same error:
java.lang.NoClassDefFoundError: org/apache/log4j/Logger

What to do (preferable in Eclipse, otherwise using jar)?

This is what I used as jar command (while working on XP-DOS):
jar cf myownjar.jar D:\lib\apache-log4j-1.2.15\log4j-1.2.15.jar
D:\lib\commons-httpclient-3.1\commons-httpclient-3.1.jar
D:\lib\commons-codec-1.3\commons-codec-1.3.jar

(Note: log4j-1.2.15.jar contains org/apache/log4j/Logger.class)
Re: Exporting libraries to jar file? [message #249177 is a reply to message #249167] Mon, 18 February 2008 06:25 Go to previous messageGo to next message
Eclipse UserFriend
Hey Abel, this is your source of documentation:

http://java.sun.com/docs/books/tutorial/deployment/jar/downm an.html

did you look at it? Apart from other things about jar files it says:

"[...] To load classes in JAR files within a JAR file into the class
path, you must write custom code to load those classes. For example, if
MyJar.jar contains another JAR file called MyUtils.jar, you cannot use
the Class-Path header in MyJar.jar's manifest to load classes in
MyUtils.jar into the class path."



Felix
Re: Exporting libraries to jar file? [message #249181 is a reply to message #249177] Mon, 18 February 2008 06:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Abel.MacAdam.eden.invalid

Thanks Felix,

That helped a lot. Now for hoping I can get an answer on my question how I
can export using Eclipse (bypassing jarring my own jar file on the command
prompt).

Abel
Re: Exporting libraries to jar file? [message #249203 is a reply to message #249181] Mon, 18 February 2008 11:28 Go to previous messageGo to next message
Eclipse UserFriend
Abel MacAdam wrote:
> Thanks Felix,
>
> That helped a lot. Now for hoping I can get an answer on my question how
> I can export using Eclipse (bypassing jarring my own jar file on the
> command prompt).
>
> Abel
>
Hi Felix. During the Eclipse export to jar, you can name an existing
manifest file to use. So, first create the manifest file (e.g.,
manifest.txt using the Eclipse editor) and then second name this file
during the Eclipse JAR file export. HTH. Mark
Re: Exporting libraries to jar file? [message #249251 is a reply to message #249203] Mon, 18 February 2008 17:53 Go to previous message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

Mark Dexter wrote:
> Abel MacAdam wrote:
>> Thanks Felix,
>>
>> That helped a lot. Now for hoping I can get an answer on my question
>> how I can export using Eclipse (bypassing jarring my own jar file on
>> the command prompt).
>>
>> Abel
>>
> Hi Felix. During the Eclipse export to jar, you can name an existing
> manifest file to use. So, first create the manifest file (e.g.,
> manifest.txt using the Eclipse editor) and then second name this file
> during the Eclipse JAR file export. HTH. Mark

The manifest will have to name the other JARs that you depend on and
their relative location. For Applet deployment on a web server those
other JARs will have to be available next to yours.
See the specification for manifest files for more details on how to
specify JARs in it.

Hope this helps,
Eric
Previous Topic:Can I attach javadoc that's online to a jar?
Next Topic:Unable to untar eclipse in hp-unix
Goto Forum:
  


Current Time: Fri May 09 20:44:38 EDT 2025

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

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

Back to the top