Packaging files inside jars

Hi, I got some free time yesterday and coded this:

www.http://www.rel.phatcode.net/Temp/HangFighter.zip

It’s a game I prototyped trying to combine hangman and space invaders.

Kinda bad looking but I like the idea. Nice game to port to droid.

How do I pack other files inside the jar when I export it? For graphics I just put them inside the src/gfx/ folder. Can I do that say with text files and audio?

Also, anyone knows of a royalty free dictionary I could read words from? My current build has 1 single word.

Thanks!

You can acquire a stream to any resource in the JAR, it doesn’t matter what kind of data is contained in that resource. You will need to decorate\adapt the stream appropriately though if you’re going to read text from it.

Do I could say, add a /resource folder under /src and load it like I load gfx?

Can’t code right now to test it. :frowning:

Whatever you do with your graphics resources you should be able to do with your plain-text resources.

Thanks!

Now, if I could only get my hands on that dictionary.

This is the dictionary file I use for Eclipse, should be meet your needs fairly well.

Thanks! This should make my life easier. Btw, what do you mean by “dictionary I use for eclipse” and for what purpose.

I thought I posted this a couple hours ago. Oops. Must have hit preview instead of post.

Another dictionary, provided by Oracle, actually, as demo data. I use it in a Boggle-clone.

http://docs.oracle.com/javase/tutorial/collections/interfaces/examples/dictionary.txt

You can add a dictionary file to Eclipse to use for spell check. If it is good enough for spelling, then it should be good enough for a hangman game! ;D

[quote=“relminator,post:1,topic:44596”]
12dict 2of12inf is supposed to be suitable for word games. It’s not perfect, but for Hangman-style applications (as opposed to Scrabble-style games where people get upset if QAT isn’t in your dictionary) it should be fine.