2

I have a game that runs well on Windows and Mac but in Ubuntu it doesn't find the image(s). That's exactly the problem, it doesn't find the image.

I'm trying to run this on Ubuntu 12.1 with Java Web Start

This is what I use to load an image:

this.getClass().getClassLoader().getResource("pixelapp/wavelogy/images/boat.jpg");

My package is pixelapp.wavelogy

This is my code snippet in case you REALLY need it:

    String folder = "pixelapp/wavelogy/images/"; 

    fileName[count] = folder + "boat.jpg"; 

    pTex[count] = TextureIO.newTexture( 
                            cl.getResource(fileName[count]), false, null); 

END OF CODE SNIPPET.

Any ideas on how to solve this?

EDIT:

Unable to use Firefox's proxy settings. Using "DIRECT" as proxy type.
Error loading texture pixelapp/wavelogy/images/redboat.jpg
Error loading texture pixelapp/wavelogy/images/pinkboat.jpg

Exception in thread "Timer-0" java.lang.NullPointerException
    at pixelapp.wavelogy.Wavelogy.display(Wavelogy.java:2739)
    at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:373)
    at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:358)
    at jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:280)
    at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:655)
    at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:594)
    at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:543)
    at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:74)
    at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:142)
    at com.jogamp.opengl.util.FPSAnimator$1.run(FPSAnimator.java:128)
    at java.util.TimerThread.mainLoop(Timer.java:555)
    at java.util.TimerThread.run(Timer.java:505)
X11Util.Display: Shutdown (JVM shutdown: true, open (no close attempt): 2/2, reusable (open, marked uncloseable): 0, pending (open in creation order): 2)
X11Util: Open X11 Display Connections: 2
X11Util: Open[0]: NamedX11Display[:0, 0x927bf60, refCount 1, unCloseable false]
X11Util: Open[1]: NamedX11Display[:0, 0x9207ba8, refCount 1, unCloseable false]
4

1 回答 1

1

如果您只尝试:它会不起作用:

this.getClass().getClassLoader().getResource("images/some_image.jpg");

因为我想你的课程在 pixelapp.wavelogy 包中,所以我在 pixelapp/wavelogy 文件夹中,在那里你也有一个 images 文件夹。

于 2012-12-19T07:49:31.293 回答