Jar files

Hi is possible to jar everything up including sound and txt files? This is because when i jar up my java project, it doesnt jar up the sound and txt files, and hence i have to place the txt and sound files next to the jar file in order for the jar file to run properly. Please help,

thanks.

[303 byte] By [AbdulHaquea] at [2007-11-27 1:40:54]
# 1

Yeah, I do it all the time. All you have to do is list the sound and text files on the command line as stuff to stick into the jar. (That's using the command-line tool provided by the JDK.)

This is so easy, in fact, that I suspect you must be using some other tool to make your jars? Maybe the jar export facility of an IDE?

paulcwa at 2007-7-12 0:55:41 > top of Java-index,Java Essentials,Java Programming...
# 2
You could also put your resources in a jar separate from the code jar, if that is what you require, although the jarring process is the same.
DrLaszloJamfa at 2007-7-12 0:55:41 > top of Java-index,Java Essentials,Java Programming...
# 3
How are you creating this JAR. If you are using an IDE such as NetBeans(free) then you are missing the file filter labeled Jar Recipe Filter when you name and create your JAR. I would assume that most IDEs have a similar feature.
billcrupa at 2007-7-12 0:55:41 > top of Java-index,Java Essentials,Java Programming...
# 4
Take the JAR tutorial: http://java.sun.com/docs/books/tutorial/deployment/jar/index.html
DrLaszloJamfa at 2007-7-12 0:55:41 > top of Java-index,Java Essentials,Java Programming...
# 5

Hi all, thank you for all your help, i am using eclipse to jar it up,

and so

i have 2 java packages - its a brown colour, and 2 separate packages for html pages and images - its a grey colour, they are all in the src folder.

The sounds folder and a text file are located in the project folder but not inside the src folder, is this the problem? What can i do, can i either put the sound folder and the txt file inside the src folder or is there a way to jar everything up regardless of it being in the src folder?

thanks.

AbdulHaquea at 2007-7-12 0:55:41 > top of Java-index,Java Essentials,Java Programming...
# 6

If I recall correctly, the export function that creates jars has a checkbox that says something like "include non-code resources in this jar" or "also include content from these folders in the jar" and then it has a widget that lets you select folders from the project.

Just examine the export-to-jar wizard more carefully. It's in there. It's been a while since I used Eclipse but when I did I did this sort of thing all the time and it worked fine.

paulcwa at 2007-7-12 0:55:41 > top of Java-index,Java Essentials,Java Programming...