Reputation: 740
I have my eclipse project setup as follows. As you can see I have 'gamedata', 'images', and 'sounds' folders set in my buildpath as libraries.
Here is the folder structure of my project.
I have been work on this client server game for quite some time now in eclipse and all is well. I wanted to try to 'export' this as an 'executable jar' file. I did that and when I went to run it, I got an error loading an image. I then extracted the contents of that jar file to see why it was missing and realized that the 'gamedata', 'images', and 'sounds' folders are all not there, rather their subfolders/contents are at the top level.
This is the extracted folder below where you can see the missing top level folders.
Can anyone help me out here? Sorry if this is a stupid question but I have tried so many things in the build path and admittedly do not have much familiarity with it. I have tried to look online for proper project setups(I remember using a res folder in programming classes way back) and would appreciate any guidance on best practices as far as folder naming is concerned.
Thanks for any help here.
Upvotes: 1
Views: 117
Reputation: 1327624
You need to declare images
and gamedata
under a "resources
" folder, as in this question
Right-click your project, new
, Resource Folder
.
Add the path you want (images
and gamedata
).
Then select the option "Export Java source files and resources
" when creating your jar executable.
Upvotes: 1