Say I have developed a game, and placed it in the package structure:
com.dxmio.games.breakout
Where then is the 'best practice' place to put resources like audio and images that the game uses?
Say I have developed a game, and placed it in the package structure:
com.dxmio.games.breakout
Where then is the 'best practice' place to put resources like audio and images that the game uses?
I have seen this handled in a number of different ways:
I tend to favor the last option.
You can then use the java.lang.Class.getResource() method to retrieve your resources.
You can always adopt a standard Maven approach to your project and put all application source files in
{home}/src/main/java/com/dmxio/games/breakout
and then you resources live in
{home}/src/main/resources/com/dmxio/games/breakout
Your tests then live in:
{home}/src/test/java/com/dmxio/games/breakout
This structure is a standard convention to structuring projects in the Maven world. It brings a lot of advantages with it, which you may want to look at. You can check out the resources section here:
http://maven.apache.org/guides/getting-started/index.html#How_do_I_add_resources_to_my_JAR
Alternatively :) the other approach here is just fine...