1
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.

Puck
  • 2,080
  • 4
  • 19
  • 30
caxco93
  • 33
  • 5
  • 1
    What are you using to compile and run, and how are you trying to do that? It looks like it's just a classpath issue... – Jon Skeet Mar 02 '14 at 18:03
  • im using eclipse. i have all the .jars needed on my classpath. lwjgl.jar, lwjgl-util.jar, nifty.jar, nifty-lwjgl-renderer.jar, nifty-default-controls.jar, nifty-examples.jar, nifty-style-black.jar, xpp3-1.1.4c.jar – caxco93 Mar 02 '14 at 18:10
  • Well which of those (if any) contains `org.bushe.swing.event.EventTopicSubscriber`? – Jon Skeet Mar 02 '14 at 18:11
  • org.bushe.swing.event.EventTopicSubscriber is for Nifty.subscribe [link](http://nifty-gui.sourceforge.net/projects/1.3/nifty/apidocs/de/lessvoid/nifty/Nifty.html) – caxco93 Mar 02 '14 at 18:16
  • @JonSkeet ^ this .subscribe method – caxco93 Mar 02 '14 at 18:30
  • 1
    @caxco93: You still haven't said which jar file contains `EventTopicSubscriber`... – Jon Skeet Mar 02 '14 at 18:37
  • @JonSkeet what can i do to know that? all i know is that Nifty.subscribe() method extends org.bushe.swing.event.EventTopicSubscriber – caxco93 Mar 02 '14 at 18:44
  • @caxco93: A method doesn't extend a type... Did you mean returns? I suggest you research that location (look within the jar files you've got and search on the web). – Jon Skeet Mar 02 '14 at 18:45
  • @JonSkeet yeah.. it returns "> void". – caxco93 Mar 02 '14 at 18:51

1 Answers1

3

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.

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194