0
\$\begingroup\$

I am a beginner in Slick2D.

I use jarspliceJarSplice to output Slick2D game.

But, but it is export all thingexports everything into one jar.

I want to export one jar with the res andand native folder ....

Soso I can easily modify the game resources in the design process.

Thanks for any help.

\$\endgroup\$
  • \$\begingroup\$ You edit confuses me. \$\endgroup\$ – Vaillancourt Oct 26 '17 at 13:40
1
\$\begingroup\$

From my own personal experiences, you can't really add the res folder into the jar file unless you use InputStreams (this is so that the game can read the res files inside the jar file and not in the same folder), however, you can add the native files into the jar.

With JarSplice, there is a tab called "Add Natives," you use that tab to locate the natives you want to add to your game (i.e. windows, mac, linux native files): Under 'Add Natives', add your native files for the specified Operating System, in this case I'm adding window natives

Under 'Add Natives', add your native files for the specified Operating System, in this case I'm adding window natives.

RES: For adding res files, I would recommend to have them in the same folder as the game, but if you use InputStreams to fetch the resource files, than the following will most likely work:

Under the tab "Add Jars," add the jar of your game and for your assets, add them as a .zip file (I used WinRar to create the .zip), here's an example: add the resources in as a .zip

This way the game fetches the resource files within the jar file and not within the folder it is in.

Hopefully this will help you.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Thank you, but it can only export to a jar file? Because it resulted when I want to change the image or sound resources need to re-export. \$\endgroup\$ – casper May 17 '16 at 0:33
  • \$\begingroup\$ I don't quite understand what you are trying to ask, do you mean if there are other alternative ways to export the game other than a jar file? \$\endgroup\$ – BlueJet May 17 '16 at 1:29
  • \$\begingroup\$ I mean I can get my game looks like this?resources folder is not in the jar imgur.com/6V7sRFN \$\endgroup\$ – casper May 17 '16 at 4:30
  • \$\begingroup\$ Make the resources folder into a .zip and add it in as a jar in the "Add Jars" (the add jars button accepts .zip and .jar files, so it should work) and then in your code input your resources using an InputStream. After that, go ahead and fill out the other settings and then export it as a fat jar. Though, I would just recommend keeping the resources in the same folder as the jar, it just makes life a little easier \$\endgroup\$ – BlueJet May 17 '16 at 12:36
  • \$\begingroup\$ I would recommend to check this answer as "correct" if this has helped you, that way individuals who had the same troubles as you can reference this in the future. \$\endgroup\$ – BlueJet May 20 '16 at 19:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.