0

I think I may be missing something really obvious here, but I can't seem to find any options in Eclipse or an ANT build script:

My Java Eclipse project looks like this:

src/
   com/
res/
   sound/
   font/
docs/
libs/

so on and so forth, all at the top level. However, when Eclipse exports my project to a runnable jar, inside the jar, the res/ folder doesn't exist, and instead all of the folders inside the res folder (sound, font, etc), are in the top level of the jar.

This causes problems, as my application looks for files in res/sound - which works fine when using Eclipse's debugging tool.

How can I stop Eclipse moving my res/ directory around?

Thanks!

4

1 回答 1

0

This behavior is normal. Do not try to avoid it.

Try to get your files as InputStream instead of java.io.File

for example :

System.class.getResourceAsStream("/sound/mySound.mp3");
于 2013-03-30T12:00:33.500 回答