Slick Forums

Discuss the Slick 2D Library
It is currently Tue Oct 15, 2019 1:09 am

All times are UTC




Post new topic Reply to topic  [ 41 posts ]  Go to page Previous  1, 2, 3
Author Message
PostPosted: Tue Aug 21, 2012 9:54 pm 
Offline

Joined: Wed Feb 29, 2012 7:07 pm
Posts: 9
So I thought I was loading them incorrectly and the extra "/" was the problem. I went into my resources.xml file and changed the base directory variable to "res" without the "/". It still compiles thankfully. I exported it and all that jazz. It's still saying res//Level_1.tmx :/


Top
 Profile  
 
PostPosted: Tue Aug 21, 2012 9:56 pm 
Offline
Game Developer
User avatar

Joined: Sun Nov 12, 2006 8:40 pm
Posts: 585
CNIAngel wrote:
Yup all the tiled map files are in the res folder.

Copy the res folder into the same location as the jar file and I bet it'll start working. You need to recheck your tiledmap loading code to ensure its compatible with loading files from inside a jar file.


Top
 Profile  
 
PostPosted: Wed Aug 22, 2012 1:24 am 
Offline

Joined: Wed Feb 29, 2012 7:07 pm
Posts: 9
Thanks for the help :) It's working now that the res folder is there. I'll try and figure out the code for having it load from the jar. Once again, thank you. :)


Top
 Profile  
 
PostPosted: Wed Aug 22, 2012 3:34 am 
Offline
Regular

Joined: Tue Aug 23, 2011 8:19 am
Posts: 111
And if you do figure it out, post it here please :wink:

_________________
My indie games: http://cmagames.webs.com


Top
 Profile  
 
PostPosted: Fri Nov 16, 2012 12:26 pm 
Offline

Joined: Fri Nov 16, 2012 12:02 pm
Posts: 2
I get this error message, when i follow your steps:
Code:
Fri Nov 16 13:00:40 CET 2012 INFO:Slick Build #274
Fri Nov 16 13:00:40 CET 2012 INFO:LWJGL Version: 2.8.5
Fri Nov 16 13:00:40 CET 2012 INFO:OriginalDisplayMode: 1920 x 1080 x 32 @60Hz
Fri Nov 16 13:00:40 CET 2012 INFO:TargetDisplayMode: 1280 x 720 x 0 @0Hz
JavaVM WARNING: JAWT_GetAWT must be called after loading a JVM
_NSJVMLoadLibrary: NSAddLibrary failed for /libjawt.dylib
JavaVM FATAL: lookup of function JAWT_GetAWT failed. Exit


Top
 Profile  
 
PostPosted: Thu Jan 24, 2013 2:04 am 
Offline

Joined: Tue Oct 16, 2012 12:36 am
Posts: 73
I successfully created the jar, but it won't run. I didn't get any errors, the Jar Loader application opens, but then closes. This doesnt happen with other jar files I run. I believe it is because I didn't do the main class part right. So what exactly is supposed to be in the section for main class? The jar works on windows, but not on my Mac.


Top
 Profile  
 
PostPosted: Sun Oct 20, 2013 2:39 pm 
Offline

Joined: Sun Oct 20, 2013 2:30 pm
Posts: 1
I am having a very similar problem to the last poster. I am creating my project as a .jar file and then using jarsplice to add all the required libraries. My fat jar will not open. If I run it with cmd I simply get the error, "Unable to access jarFile Game.jar". I believe the issue lies in how I am pointing to my main class. Just to clarify, I assume it wants the path to the class that contains my main method (which in my case happens to be named Main). If I get the path directly from Eclipse, it is "/Game/src/Game/Main.java". I have tried "Game.Main" and "Game.src.Game.Main" with the same results. Do I have the path correct? Thanks.

UPDATE: I was able to get my project to run by insuring that the "native" folder from the jlwgl file is within the same folder as the fat jar. Using jarsplice to add those directly to the fat jar did not work for me.

UPDATE2: I discovered through this (https://www.youtube.com/watch?v=TfwcbMcT-Ig) tutorial that I needed to point the program to the native file location and I did not know how to do that.


Top
 Profile  
 
PostPosted: Tue Oct 22, 2013 5:41 pm 
Offline
Regular
User avatar

Joined: Thu Feb 21, 2013 1:16 pm
Posts: 135
In my experience this probably means that the lwjgl native files are not set up correctly with the jar file.

_________________
Thanks beforehand! (Optional addition ;-) )
Greetings,

HariboTer


Top
 Profile  
 
PostPosted: Sun Dec 01, 2013 9:33 pm 
Offline

Joined: Sun Apr 07, 2013 11:41 am
Posts: 6
Here is an other tutorial, using Eclipse:

1. In your main method(or a method that will run before any LWJGL/Slick2D functions), add this code:
Code:
      final String os = System.getProperty("os.name").toLowerCase();
      String path = "native/";
      
      if(os.contains("win"))
         path += "windows";
      else if(os.contains("mac"))
         path += "mac";
      else if(os.contains("nix") || os.contains("nux") || os.contains("aix"))
         path += "linux";
      else if(os.contains("sunos"))
         path += "solaris";
      
      System.setProperty("org.lwjgl.librarypath", new File(path).getAbsolutePath());


2. Export your project as a "Runnable Jar". Make sure that "Extract required libraries into generated JAR" is selected.
3. Place the folder "native", which can be found in the LWJGL directory, in the same place as the runnable jar file.
4. Run the runnable jar file and play.


Top
 Profile  
 
PostPosted: Mon Jul 04, 2016 8:46 am 
Offline

Joined: Mon Jul 04, 2016 8:23 am
Posts: 2
Hi,

Since I've been using slick myself for a while, I've created a maven template-project for quick-starting it. When built it creates a fully working distributable app containing binaries and libraries for windows and unix. It eliminates the tedious task of setting up the slick in the project every time from the beginning. Just use 'mvn clean install' and under target/dist there should be working application that you could run anywhere with Java.

https://bitbucket.org/jvali/slick-start/src

Template structure:
Image

This is what the template project looks like when built:
Image

Project dependencies:

Maven
Slick2D
SLF4J (Logback)

Currently it's not distributed as maven archetype, since I didn't have the time to learn how make one, but I'm thinking it could be made into one in the future.
Any feedback appreciated.


Top
 Profile  
 
PostPosted: Tue Sep 19, 2017 12:15 pm 
Offline

Joined: Tue Sep 19, 2017 12:05 pm
Posts: 2
There is a project of maven support for slick2d, complete with archetype. Instructions are here:
https://github.com/nguillaumin/slick2d-maven

If you initialized your game with the archetype, packaging to jar is easy as running
Code:
mvn clean package


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 41 posts ]  Go to page Previous  1, 2, 3

All times are UTC


Who is online

Users browsing this forum: Google [Bot], MSN [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group