문제

I am trying to use JWebBrowser and I get the following error:

    Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/swt/events/MouseListener
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
    at java.lang.Class.getConstructor0(Unknown Source)
    at java.lang.Class.getDeclaredConstructor(Unknown Source)
    at chrriis.dj.nativeswing.swtimpl.internal.NativeCoreObjectFactory.create(NativeCoreObjectFactory.java:36)
    at chrriis.dj.nativeswing.swtimpl.components.JWebBrowser.<init>(JWebBrowser.java:189)
    at com.js.summative.Main.<init>(Main.java:39)
    at com.js.summative.Runner.main(Runner.java:30)
Caused by: java.lang.ClassNotFoundException: org.eclipse.swt.events.MouseListener
    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)
    ... 8 more

From what I could gather online, which was not much, I need to use swt.jar which I have found and implemented into my buildpath but that is not doing any good. What's the issue here?

도움이 되었습니까?

해결책

I have found the solution to the problem. I was using the wrong swt.jar. If anyone is having the same issue, they can go to this site and get the latest swt. Also, the version of the JVM should be checked because the swt has to be the same as the JVM version. For example, 32-bit JVM requires 32-bit swt.

다른 팁

and add NativeInterface.initialize(); to main

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top