javaexceptionopengllwjglnifty-gui

NiftyGUI's Nifty class cant instantiate?


package test;

import java.io.IOException;

import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.examples.LwjglInitHelper;
import de.lessvoid.nifty.nulldevice.NullSoundDevice;
import de.lessvoid.nifty.renderer.lwjgl.render.LwjglRenderDevice;
import de.lessvoid.nifty.sound.openal.OpenALSoundDevice;
import de.lessvoid.nifty.spi.time.impl.AccurateTimeProvider;

public final class Test {

    private Test(){ 
    }

    public static void main(final String[] args) throws IOException {
        if (!LwjglInitHelper.initSubSystems("Nifty Hello World")) {
            System.exit(0);
        }

        // create nifty
        Nifty nifty = new Nifty(new LwjglRenderDevice(), new OpenALSoundDevice(),
                LwjglInitHelper.getInputSystem(), new AccurateTimeProvider());
    }
}

I'm trying to use NiftyGUI but it can't even pass the nifty = new Nifty part. I have all the dependencies.

This is the error I get for the line of Nifty nifty = new Nifty(:

Caused by: java.lang.ClassNotFoundException: org.bushe.swing.event.EventTopicSubscriber
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 1 more

Can someone help me out with this? I've even tried importing every nifty library.


Solution

  • After doing a bit of research, it looks like you're missing the eventbus jar file. You can download the jar file from the Maven repository.

    Note that I didn't know anything about this class beforehand - it was merely a matter of looking carefully at the stack trace and then doing research on the internet. Simply doing a search for the class name was enough, after a few hits.