Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411512 Posts in 69376 Topics- by 58430 Members - Latest Member: Jesse Webb

April 26, 2024, 04:44:57 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)How to export a slick2d project in Eclipse as a .jar
Pages: 1 [2]
Print
Author Topic: How to export a slick2d project in Eclipse as a .jar  (Read 6843 times)
Impmaster
Level 10
*****


Scary, isn't it?


View Profile WWW
« Reply #20 on: April 30, 2013, 05:31:51 AM »

@R.D.

Here is what I currently have. I have a src folder, and a data folder both next to each other. I have all of the links to data set as "Image.png", not "data/Image.png". "Image.png" seems to work for two out of three of my game states. If I disable the third game state, the first two work. If I add it in, it crashes, giving me a "Resource not found" exception. The first two states get their files from the same place, and I link to it like "Image.png". The third state also links to the same place in the same way, with similar files, but it keeps on crashing. It works fine in Eclipse, but as soon as I export it, it crashes.

The way I export is by exporting it as a runnable jar in eclipse, then adding on the natives in jarsplice. I think this is what you wanted me to do.

Anyone see a problem with my working? (Is it possible that I could send it to someone, so they could fix my mistakes? Sorry for being such a hassle.)
Logged

Do I need a signature? Wait, now that I have a Twitter I do: https://twitter.com/theimpmaster
rosholger
Level 1
*



View Profile
« Reply #21 on: April 30, 2013, 05:35:39 AM »

this is very strange... for me the resources where no hassle at all and i have no idea what might be causing this Shrug
Logged
R.D.
Level 2
**


Making a game about balls. Yepp.


View Profile WWW
« Reply #22 on: April 30, 2013, 10:01:17 AM »

You can send it my way and I will have a look over it. I did not use JarSplice. For natives I use a trick so I cann just put the natives folder next to the jar file.
Logged

Impmaster
Level 10
*****


Scary, isn't it?


View Profile WWW
« Reply #23 on: April 30, 2013, 07:00:30 PM »

Alright. How should I export it to give it to you? Runnable jar? File System?
Logged

Do I need a signature? Wait, now that I have a Twitter I do: https://twitter.com/theimpmaster
R.D.
Level 2
**


Making a game about balls. Yepp.


View Profile WWW
« Reply #24 on: May 01, 2013, 06:25:55 AM »

Just zip the project and send it my way. I have Slick2D myself (I once even developed for Slick2D, not long but it was fun :D).
Logged

Impmaster
Level 10
*****


Scary, isn't it?


View Profile WWW
« Reply #25 on: May 01, 2013, 04:38:44 PM »

http://www.filedropper.com/personalproject

I pasted my file here. Not quite sure how long it'll stay up, cause it's a free service...
Logged

Do I need a signature? Wait, now that I have a Twitter I do: https://twitter.com/theimpmaster
R.D.
Level 2
**


Making a game about balls. Yepp.


View Profile WWW
« Reply #26 on: May 02, 2013, 02:46:57 AM »

Okay.

So the error you get is not from the images. It's from you TiledMap. Something went wrong while loading it. It's not that Slick2D does not find the file but it has an error reading it.

The problem is simple. You don't specify a path. You simple load your files by putting the name of the file in the C'Tor. This will not work well. If you have a path. USE it. All your files are in the "data" folder so when loading you must append the path before the file.
Code:
Image image1 = new Image("data/Image 1.png");
BlockMap map = new BlockMap("data/map01.tmx");
Also you should read up some tutorials about graphics programming, Slick2D and game programming in general since it looks like you make yourself a hard time (You don't need that much fade images. You can simply draw a colored quad with a color over the screen and it has the same effect saving textures).

I hope this helps Smiley At least I did here some sound when I added the correct path.
Logged

Impmaster
Level 10
*****


Scary, isn't it?


View Profile WWW
« Reply #27 on: May 02, 2013, 04:18:56 AM »

Thanks a lot for helping me man, but I still have problems. I think I know why the tiledmap wasn't working. It's calling upon a player, which then asks the gameplaystate for a spritesheet, which is giving a nullexception error.

Code:
Exception in thread "main" java.lang.RuntimeException: Resource not found: data/SpriteSheet.png

The SpriteSheet is in the same place as all my other files, and all my other files all seem to be working. This one image is not.

Also, I know that a lot of my code is bad.  Tongue This is my first real project, and I learned a lot over the time. For some reason, instead of spending time googling the problem, I thought I would brute force the fades.  Durr...?
Logged

Do I need a signature? Wait, now that I have a Twitter I do: https://twitter.com/theimpmaster
Impmaster
Level 10
*****


Scary, isn't it?


View Profile WWW
« Reply #28 on: May 02, 2013, 05:01:59 AM »

Oh. My. Science. I just realized that the week of debugging has all been because of my spritesheet. I now have a workable jar. See, the thing that I had done wrong was referring to the spritesheet as "data/SpriteSheet.png", when it was actually "data/Spritesheet.png". That one s has caused me so much havoc. For some reason, it ran in Eclipse, while it didn't in the export. Thank science that's finally over.

 Toast Left for all who helped me. Thanks, and sorry for spamming your "show new replies".

 Tears of Joy
Logged

Do I need a signature? Wait, now that I have a Twitter I do: https://twitter.com/theimpmaster
R.D.
Level 2
**


Making a game about balls. Yepp.


View Profile WWW
« Reply #29 on: May 02, 2013, 06:08:40 AM »

Nah it's okay :D Starting with game programming comes with a lot of learning and stuff. A advice from my site would be to decide on a naming convention for all your files. Here is just a convention I use (And a lot of people too).

Convention:
  • all lower case
  • no whitespaces, use "-" to connect words (eg. "image-bla.png"

And as said, you best use a static class to hold your resources and you simple refer to them. This makes it easy for the change file names.

Happy Programming Smiley
Logged

Pages: 1 [2]
Print
Jump to:  

Theme orange-lt created by panic