aspose file tools*
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
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: 18117
    
  39

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)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: creating jar file from eclipse
 
Similar Threads
Jar file creation using eclipse
creating Jar files using Eclipse3.2
ant classs path problem
Run jar file from eclipse
help needed with creating jar file