English 中文(简体)
Slick2d Can t find image even though it s in the right area
原标题:

I m following the tutorials found on the Slick2D website, and upon loading Images to my program, I get an error that says:

Tue Nov 01 14:12:47 EDT 2011 INFO:Slick Build #274
Tue Nov 01 14:12:47 EDT 2011 INFO:LWJGL Version: 2.8.1
Tue Nov 01 14:12:47 EDT 2011 INFO:OriginalDisplayMode: 1024 x 768 x 32 @60Hz
Tue Nov 01 14:12:47 EDT 2011 INFO:TargetDisplayMode: 800 x 600 x 0 @0Hz
Tue Nov 01 14:12:48 EDT 2011 INFO:Starting display 800x600
Tue Nov 01 14:12:48 EDT 2011 INFO:Use Java PNG Loader = true
Tue Nov 01 14:12:48 EDT 2011 INFO:Controllers not available
Exception in thread "main" java.lang.RuntimeException: Resource not found: C:UsersAndrewworkspaceSirSlimedataimageslang.jpg
   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 awesome.Main.init(Main.java:33)
   at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:390)
   at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:314)
   at awesome.Main.main(Main.java:19) 

The line:

Resource not found: C:UsersAndrewworkspaceSirSlimedataimageslang.jpg

confuses me as the picture I m trying to load IS in that exact area. This is the code I m using to load:

 // ship = new Image("../../data/images/ship.png"); Does not work
  // land = new Image("../../data/images/land.jpg"); Does not work
  ship = new Image("C:\Users\Andrew\workspace\SirSlime\data\images\ship.png");
  land = new Image("C:\Users\Andrew\workspace\SirSlime\data\images\lang.jpg"); 
问题回答

Sorry for being obvious, but in one place you use the file name "lang.jpg" and in another "land.jpg", just a typo?





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签