Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (804)
Games in Android Showcase (237)
games submitted by our members
Games in WIP (867)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [Solved] Issue with LWJGL Space Inaders Example  (Read 8486 times)
0 Members and 1 Guest are viewing this topic.
Offline gmmaster

Senior Newbie

« Posted 2013-11-08 08:22:49 »


I am trying to run the Space Invaders example from the LWJGL wiki. This one.

What is odd to me is that there is no red 'x's in Eclipse and it seams like I have
properly attached all the libraries right.  

Here is the error it gives me.

Fri Nov 08 02:26:45 CST 2013 INFO:Slick Build #237
Fri Nov 08 02:26:45 CST 2013 INFO:LWJGL Version: 2.9.0
Fri Nov 08 02:26:45 CST 2013 INFO:OriginalDisplayMode: 1440 x 900 x 32 @0Hz
Fri Nov 08 02:26:45 CST 2013 INFO:TargetDisplayMode: 800 x 600 x 0 @0Hz
Fri Nov 08 02:26:45 CST 2013 INFO:Starting display 800x600
Fri Nov 08 02:26:46 CST 2013 INFO:Use Java PNG Loader = true
Fri Nov 08 02:26:46 CST 2013 INFO:Controllers not available
Exception in thread "main" java.lang.RuntimeException: Resource not found: testdata/alphamap.png
   at org.newdawn.slick.util.ResourceLoader.getResourceAsStream(
   at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(
   at org.newdawn.slick.Image.<init>(
   at org.newdawn.slick.Image.<init>(
   at org.newdawn.slick.Image.<init>(
   at org.newdawn.slick.Image.<init>(
   at org.newdawn.slick.tests.AlphaMapTest.init(
   at org.newdawn.slick.AppGameContainer.setup(
   at org.newdawn.slick.AppGameContainer.start(
   at org.newdawn.slick.tests.AlphaMapTest.main(

Thank you so much for reading this and trying to help. Smiley

loopish's brother Cheesy
Offline philfrei
« Reply #1 - Posted 2013-11-08 08:55:29 »

Did you find and load the resource files mentioned in the instructions?

The error code is saying that it can't locate alphamap.png, which is a graphical resource used in the program. It may be that you have to create/add the filefolder "testdata" to the project and move the resources to that location. Have you loaded resources before?

I ran this tutorial once, I think it was in August, but have since deleted the project, and can't remember exactly what all I had to do to get it to work.

music and music apps:
Offline gmmaster

Senior Newbie

« Reply #2 - Posted 2013-11-08 09:09:07 »

It's possible I didn't load it right? I just made a folder in my workspace project folder called 'res' and put all the files that came with lwjgl in there. I also made a folder called testdata because I thought that might work, though it didn't. The odd thing is that there is no file named 'alphamap.png' that I could find with the lwjgl resources. Is it possible this has to do something with the slick library?? There were no errors with the red Xs which it normally does when I don't have the correct packages imported. Tongue

EDIT: wow, I just found that this same exact error is happening for me on a completely different project folder. What is odd is that this other project is not using the slick libraries at all...

loopish's brother Cheesy
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline philfrei
« Reply #3 - Posted 2013-11-08 20:20:09 »

You are not alone...
(LOL--I was doing a search on alphamap.png and the above came up.)

BTW, questions about loading resources come up a LOT, as getting the addressing right, especially in jars. So, it doesn't surprise me that the problem comes up in an entirely separate context.

The Java Tutorials section that deals with resource loading is here:
They are discussing this in the context of loading an image into an icon, but the part about loading images in general and about the relative addressing still pertain.

You might consider going through this set of Space Invaders tutorials instead:

There are four versions, and if I remember correctly, 104 uses LWJGL. I recall getting 3 of them to work--I remember skipping one of them.

I also wonder if the file is part of the Slick download, if there are some resources packed with the full distribution.

The writer Kevin Glass is listed with JGO, and often comments/contributes. But since he officially handed this code off, he might not wish to be asked maintenance questions. I really don't know him well enough to say.

music and music apps:
Offline Vladiedoo
« Reply #4 - Posted 2013-11-08 20:30:35 »

I couldn't explain in depth why it occurs but I believe your issue might be the following.

You can make Source Folders or regular Folders while in Eclipse.

If you have a regular folder you will need to do "res/testdata/alphamap.png".
If you have a source folder you can do "testdata/alphamap.png".

So try "res/testdata/alphamap.png" and if that doesn't work, post a screenshot.

Good luck.
Offline Magn919

Junior Devvie

Medals: 6
Exp: 5 years

« Reply #5 - Posted 2013-11-08 23:17:55 »

Hi gmmaster, you are getting that error, because you are not running your own main method.

The slick library contains numerous example programs, each with its own main method.

At the time you first attempted to run your code, you may not have had focus on the editor or may have had another class open, so eclipse couldn't find a main method.
This makes it search the build path for a main method, and it finds all those inside Slick and sorts them alphabetically, and picks the first (it may have shown a dialog too).
So you are actually running, it says that in the stack trace too, and as another feature of eclipse it remembers which file you ran last, so it keeps running that when you click the run button.

A simple solution is to open your own class in the editor, right click in the editor, and run it from there, this it should remember too, so doing it once should be enough.

For every new problem, a new source of solutions has come to exist.
Offline gmmaster

Senior Newbie

« Reply #6 - Posted 2013-11-09 07:19:42 »

Thank you everyone!!

Especially Magn919 for the solution and easy fix and philfrei for all the links and info.

loopish's brother Cheesy
Pages: [1]
  ignore  |  Print  

Riven (397 views)
2019-09-04 15:33:17

hadezbladez (5280 views)
2018-11-16 13:46:03

hadezbladez (2204 views)
2018-11-16 13:41:33

hadezbladez (5544 views)
2018-11-16 13:35:35

hadezbladez (1150 views)
2018-11-16 13:32:03

EgonOlsen (4585 views)
2018-06-10 19:43:48

EgonOlsen (5462 views)
2018-06-10 19:43:44

EgonOlsen (3119 views)
2018-06-10 19:43:20

DesertCoockie (4016 views)
2018-05-13 18:23:11

nelsongames (4708 views)
2018-04-24 18:15:36
A NON-ideal modular configuration for Eclipse with JavaFX
by philfrei
2019-12-19 19:35:12

Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!