This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Java in General and the fly likes creating jar file from eclipse Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "creating jar file from eclipse" Watch "creating jar file from eclipse" New topic
Author

creating jar file from eclipse

Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

I want to create the JAR file from Eclipse IDE. That's rather easy -> Create Runnable JAR. BUT, I want to add .JPG file, other .JAR files and .DLL files to that final JAR. Moreover I have to set some arguments for the JVM.

Do you have any ideas?


SCJP6, SCWCD5, OCE:EJBD6.
BLOG: http://leakfromjavaheap.blogspot.com
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18914
    
  40

Lucas Smith wrote:I want to create the JAR file from Eclipse IDE. That's rather easy -> Create Runnable JAR. BUT, I want to add .JPG file, other .JAR files and .DLL files to that final JAR. Moreover I have to set some arguments for the JVM.

Do you have any ideas?


A jar file is just a zip file, and can hold anything -- jpg files, other jar files, DLLs, etc. However, while java does allow you to access the files in a jar file, it doesn't allow you to use it like any other file in the file system. So, one option is to create an installer class. The class will check the file system for the files you need, and if not available, extract it from the jar file to the file system. Basically use the jar file only for packaging -- and have it extract at run time.

As for your second question, you can use a configuration file -- and extract it the same way as your first question.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
Consider Paul's rocket mass heater.
 
subject: creating jar file from eclipse