Loading resources in Webstart

i am fighting with webstart …

localy my game works fine, but when i try to launch it over webstart, ResourceLocator can't seem to find the resources anymore.

java.lang.NullPointerException: baseDir can not be null.

at com.jme.util.resource.SimpleResourceLocator.<init>(Unknown Source)

at stardust.core.Start.main(Start.java:53)

Inside the main package stardust, i have all other packages and also the data folder.





is that the correct way to setup packages?

    new SimpleResourceLocator(Start.class.getClassLoader().getResource( "stardust/data/textures/")))

if someone wants to try:

edit: only windows for now ..

i made a simple test app to verify my problem:

works fine in eclipse but fails packaged in a jar:


works fine both in eclipse and packged in a jar:


why can the ClassLoader return an Url to a textfile, but not to the directory containing it?

hmm ok when exporting in eclipse, be sure to check 'add directory entries'.

that solved the first problem (base dir cannot be null)

Still now the resource locator can't seem to find a .ogg file.

… need further investigations …

I fixed this problem in SimpleResourceLocator some days ago… do you use current CVS version?

no i'm using a version from a few weeks ago, guess i'll update and build new.

i've updated and repacked everything from cvs.

I double checked lwjgl.jar and lwjgl-windows.jar and openal-windows.jar.

But now i get the following exception.

org.lwjgl.openal.OpenALException: OpenAL error: Invalid Value (40963)

at org.lwjgl.openal.Util.checkALError(Util.java:64)

at org.lwjgl.openal.AL10.alBufferData(AL10.java:1055)

at com.jmex.audio.openal.OpenALAudioBuffer.setup(Unknown Source)

at com.jmex.audio.util.AudioLoader.loadWAV(Unknown Source)

at com.jmex.audio.util.AudioLoader.fillBuffer(Unknown Source)

at com.jmex.audio.openal.OpenALSystem.createAudioTrack(Unknown Source)

at com.jmex.audio.openal.OpenALSystem.createAudioTrack(Unknown Source)

at util.SoundUtil.addFx(SoundUtil.java:158

this webstart stuff is pretty much a pain in the …  :x

anyone got an idea what i need to check?


it works with the newest jme libs.


oh, fixed that accidentally then :smiley: (see this topic)

thats why i tried again :slight_smile:

I am also having issues with this and I have the latest jme2.0

Here is the code I use to setup the resource locator

try {


new SimpleResourceLocator(


} catch (URISyntaxException e) {

// TODO Auto-generated catch block



try {


new SimpleResourceLocator(


} catch (URISyntaxException e) {

// TODO Auto-generated catch block



This works totally fine when launching from eclipse.

YET… when I make a JNPL build I get the following

May 7, 2009 3:21:59 PM class CubeMobile start()

SEVERE: Exception in game loop

java.lang.NullPointerException: baseDir can not be null.

at com.jme.util.resource.SimpleResourceLocator.<init>(SimpleResourceLocator.java:61)

at CubeMobile.simpleInitGame(CubeMobile.java:55)

at com.jme.app.BaseSimpleGame.initGame(BaseSimpleGame.java:544)

at com.jme.app.BaseGame.start(BaseGame.java:74)

at CubeMobile.main(CubeMobile.java:26)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.sun.javaws.Launcher.executeApplication(Unknown Source)

at com.sun.javaws.Launcher.executeMainClass(Unknown Source)

at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)

at com.sun.javaws.Launcher.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

May 7, 2009 3:21:59 PM com.jme.app.BaseSimpleGame cleanup

INFO: Cleaning up resources.

May 7, 2009 3:21:59 PM com.jme.app.BaseGame start

INFO: Application ending.

This is driving me CRAZY… does anyone have any ideas on this…

I am using the Webstart plugin for Eclipse and I am building a "runnable jar" of my project.

Are the textures and models folder in your classpath?

In eclipse the folders need to be marked as source folders in your project properties.

Also try without the leading /  (i'm not sure if its needed or not)

Thanks, I will try that.

In the meantime is there a way to "emulate" these errors when I run the project in eclipse. It is very frustrating to have the project all working off the "play" button in eclipse and then eating s**t when I make a jnlp :slight_smile:


How do I add the models and textures folders to the classpath in eclipse?  There are 2 buttons 1 is marked Add Folder, the other is marked link source, whats the difference?


its "add folder …",  never used link source yet

How do I mark them as source in eclipse project properties?  The dirs are under the src  (src/data/models)

The src dir is set in the "source" properties and it says Included (all). shouldn't that take care of it?  If I try and add the models and textures dirs seperately it gives me a nesting error and I can't continue.


src/data/models should be fine then, as 'src' is already a source folder.

That should work:

    new SimpleResourceLocator(YourClass.class.getClassLoader().getResource("data/models/")));