How to display image from local computer in nifty-gui with java web start


I’m going to make a simple app, to present an image from user local directory. I’ve GUI in made in nifty-gui, and want to load image into nifty Image control.

The problem is that nifty-gui can load image only from assets, can’t load from file on local directory.

All clues are welcome.

Thanks in advance!


I would try reimplementing ImageBuilder to just use whatever URL you give it for a file… I’ve nevermlookedmat the source there, but it shouldn’t be a terribly difficult thing to swap…

1 Like

That will be great, thanks!

It will be possible to automatically resize the image to fit in control box size?

I don’t do much work (any) with Nifty so that’s a question best left for the docs methinks :slight_smile:

1 Like
@bdfhjk said:
The problem is that nifty-gui can load image only from assets, can't load from file on local directory.

Thats not true, if you wanna read/write locally you need to execute the applet in non-restricted mode and then you can just put a locator in the root of the user filesystem.
1 Like

I though, that I was running my app without sandbox. I’ve signed web-app using my key and run it using standard JMonkeyPlatform options.

I’ve received an error: com.jme3.asset.AssetNotFoundException: /home/marek/photo2.jpg (Flipped)


[java] image(new ImageBuilder() {{

// filename(“Interface/logo.png”);



Another fact is, that I can browse files in my filesystem from java app.

How to check, if I’m in restricted mode, how to change it?

Add a locator for the file system root and load it via the assetmanager!!

1 Like

Could You provide me a correct link, where to read about it?

I don’t know what is it a locator, and googling have no effects. I found only, but don’t know how to use it.

Thanks in advance!

Hello Assets tutorial, plz do your homework

1 Like

Thanks, it work!

For people looking for code:


assetManager.registerLoader(AWTLoader.class, "jpg");

assetManager.registerLocator("/", FileLocator.class);

image(new ImageBuilder() {{




1 Like