Java Web Sart Ubuntu 12.1。加载资源(图像)

时间:2012-12-19 06:33:01

标签: java ubuntu embedded-resource java-web-start

我的游戏在Windows和Mac上运行良好,但在Ubuntu中却找不到图像。这正是问题,它找不到图像。

我正在尝试使用Java Web Start在Ubuntu 12.1上运行它

这是我用来加载图片的内容:

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

我的包是pixelapp.wavelogy

这是我的代码片段,以防您真正需要它:

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

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

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

代码截止日期。

关于如何解决这个问题的任何想法?

编辑:

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]

1 个答案:

答案 0 :(得分:1)

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

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

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