Sign in to follow this  
mako_5

[java] JAR file creation with archived source extensions

Recommended Posts

mako_5    103
Good afternoon! I'm having trouble making .jar files with Eclipse, but I'm willing to go around Eclipse to get this to work. I'm using an architecture I made myself and I added it as an "user library" in Eclipse, along with LWJGL which I also made into another "user library." They don't get added when I try to make an executable .jar file, and end up with NoClassDefError's when I try to run it. So, really what I'm asking, is how do I add source archived in a .jar file, along with native .dll files to make the .jar file read them? Do I need to do stuff to MANIFEST.MF, and do I just manually add them to the .jar files (by renaming the .zip files and adding them)? Can anyone offer any Eclipse help, or show me how to do this from the command line using standard java controls? ------------ Good luck to everyone at 4E5!

Share this post


Link to post
Share on other sites
5MinuteGaming    274
Hi,

I looked into your problem and found one article and a forum post that will help you with your situation.

Article Java Lobby - Explains how to add dlls needed for executable jars.
Post Java Technology Forums - Refers to the article and offers similar suggestions

In addition if you need to know how to embed jar files a quick look into the Jar Specifications might yeild a helping hand.

Hope this helps, any further questions don't hesitate to ask!

Share this post


Link to post
Share on other sites
nmi    978
You can let eclipse generate a JAR by selecting File->Export->JAR, then making the appropriate choices. It is possible to let eclipse create the MANIFEST.MF, containing the startup class (the one used when calling 'java -jar myjar.jar').

If the user library you created is part of the workspace you may also select to put the generated classes of that library into the jar.

A jar may and should only contain class files and resources. Putting DLLs into a jar is not recommended. When executing your java application those need to be available as files anyways.

An option would be to put DLLs into your jar as resources, then extracting them after the application was started to the file system as temporary files and loading them after that.

Share this post


Link to post
Share on other sites
mako_5    103
Awesome, ya'll! Just what I was looking for! (Rate++)

Oh, also, my game for which this is for is now available for download (no sound, but everything else works great). Here

[Edited by - mako_5 on August 17, 2006 3:28:23 PM]

Share this post


Link to post
Share on other sites
5MinuteGaming    274
Hey,

Great glad to have helped. I can't wait to play it. Though the computer I'm on right now only has Java 1.4 so I can't run your code but I will try it as soon as I get the chance.

Also I noticed that a large majority of the file size is due to a 1024x758 image that is mostly black. You can clip the portion that is drawn on to about 516x264 saving about 1.6mb you'd also save a lot of bandwidth from whereever your hosting the zip. Just a suggestion though.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this