File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes jar files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "jar files" Watch "jar files" New topic
Author

jar files

Munaf Sheikh
Greenhorn

Joined: Mar 31, 2008
Posts: 10
Hi,

Is it possible to add files other than Java files, like .txt and .bmp/.jpeg files into a jar file, so that when run with java -jar jvapackage.jar it sees the txt/image files. It doesn't have to be able to add/edit any files already IN the archive.

Thanks in advance,

Munaf
Munaf Sheikh
Greenhorn

Joined: Mar 31, 2008
Posts: 10
some more info:

I'm writing an Image Library where in I have several thousand images in folders and a few java classes do various things with the images. The images don't change and I want to jar them all together for portability.

Thanks again,
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36590
    
  16
Originally posted by Munaf Sheikh:
Is it possible to add files other than Java files, like .txt and .bmp/.jpeg files into a jar file?
As far as I know, YES.

Have a look at This part of the Java Tutorials, particularly the bit about creating a .jar file. That appears to tell you how you can add pictures and text files to a jar.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jar files
 
Similar Threads
Cannot compile a file in WindowsXP
Problem when executing runnable jar file.
Ant excludes under fileset not working
JTree - Compare Nodes problem
Accessing contents of a jar file