Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I started a tutorial for java's slick 2d library, called SlickBlocks which is essentally a tetris clone. The problem is I have followed and typed in the code examples to the dot, yet when I run it I get the exception: Exception in thread "main" java.lang.RuntimeException: Resource not found: testdata/alphamap.png. I just started the tutorial and am up to "Making a cool effect with Image scale".

Any ideas?

Edit:

The error has occured at:

at org.newdawn.slick.util.ResourceLoader.getResourceAsStream(ResourceLoader.java:69)
at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:169)
at org.newdawn.slick.Image.<init>(Image.java:196)
at org.newdawn.slick.Image.<init>(Image.java:170)
at org.newdawn.slick.Image.<init>(Image.java:158)
at org.newdawn.slick.Image.<init>(Image.java:136)
at org.newdawn.slick.tests.AlphaMapTest.init(AlphaMapTest.java:33)
at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:390)
at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:314)
at org.newdawn.slick.tests.AlphaMapTest.main(AlphaMapTest.java:79)

Also not that I am not using "alphamap.png" anywhere in the game, I think It is just referenced by the library itself.

share|improve this question
    
Can you post the piece of code where the exception occurred. –  Takumi Feb 16 '12 at 9:17
    
@Takumi OK, I posted the code. (Or the exception really as the code where the exception occured is in the library) –  Darestium Feb 16 '12 at 9:31

1 Answer 1

up vote 2 down vote accepted

it seems you're not the only with this problem :

http://slick.javaunlimited.net/viewtopic.php?p=24806

This exception occurred because there is a missing folder "testdata" and a file "alphamap.png". This file is used by test classes of Slick. Have you downloaded the full distribution or only the library? When i download the full distribution i can find a testdata folder inside the zip file. You can find it here:

http://slick.cokeandcode.com/

You can find a link to download the full distribution in the menu at the right of the page.

share|improve this answer
    
Yup, I've got the full destribution, but it seems when I add the "testdata" folder to the project it runs fine, but for some reason it is not using my code, but is using the default stuff even though the code is overriden... So what shows up are a bunch of images from that folder rotating and stuff... –  Darestium Feb 16 '12 at 9:49
1  
It seems when you run your project you're running Slick tests. I'm not very good in Java; but i've created a new project in Eclipse, added the .jar of the Slick library in my Build Path and copy/paste some code coming from the tutorial. It works well. I'm not quite sure but did you use the .jar or did you copy the source code of Slick in your project? I think you're not using .jar in order to use Slick and this will explain why tests are launched. am I wrong? –  Takumi Feb 16 '12 at 10:27
    
Well, I imported the two jar files (slick.jar and lwjgl.jar) into my java build path. By right clicking on my project -> properties -> java build path -> libraries -> add external jars (slick.jar and lwjgl.jar). Then I set the lwjgl.jar property (when you expand the node, Native library location) to the Slick folder where the native is. –  Darestium Feb 16 '12 at 21:58
    
Figured it out, for some reason the file which the game was set to start up from was the menu class, so I changed it to the class where the main function was located. –  Darestium Feb 17 '12 at 7:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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