Menu

JWebBrowser - NoClassDefFoundError

Help
Davit
2009-07-28
2023-07-11
  • Davit

    Davit - 2009-07-28

    Hi,
    I am trying to use JWebBrowser, but I am getting the following error:
    Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: chrriis/dj/nativeswing/swtimpl/components/JWebBrowser
    at net.nbirn.mbat.plugins.registration.WebBrowser.layoutPanel(WebBrowser.java:75)
    ...
    Could you please help me?
    Thanks

     
    • Davit

      Davit - 2009-08-07

      hi Christopher,
      Thanks for reply. I added the all appropriate jar files, but the JWebBrowser has only JWebBrowser(NSOption... options) constructor, however in your example code you are initializing JWebBrowser with JWebBrowser() constructor which is not mentioned in the class summary. It works in your code, but for me it gives a constructor error. Could you please explain how you make it work?
      Thanks

       
      • Christopher Deckers

        > JWebBrowser(NSOption... options)

        This is a vararg, a Java 5 feature. The project is to be used with a Java 5 or later JRE.

        -Christopher

         
    • Christopher Deckers

      Hi,

      I may be wrong but this looks a lot like a basic Java error: the DJ Native Swing JAR files are missing from your classpath.
      You need to add DJNativeSwing.jar, DJNativeSwing-SWT.jar and some of the JARs in the lib folder depending on the features you use (the SWT JAR is mandatory, the JNA JARs are generally needed).

      Hope this helps,
      -Christopher

       
  • tahri haroune

    tahri haroune - 2023-06-21

    hi Christopher,

    After adding all necessary JAR files i'm still getting this error on eclipse.
    Erreur : impossible d'initialiser la classe principale Test.GMaps
    Causé par : java.lang.NoClassDefFoundError: chrriis/dj/nativeswing/swtimpl/components/JWebBrowser

    Thanks

     
    • Christopher Deckers

      Hi,

      I don't think you have the relevant JAR files in your classpath. You need:
      - NativeSwing.jar
      - NativeSwing-SWT.jar
      - The SWT library conforming to your platform (64 bit, Windows, etc.)

      Hope this helps,
      -Christopher

       
  • tahri haroune

    tahri haroune - 2023-06-26

    thank you Christopher,

    It works know, i have one more question : when navigate on sites JWebBrowser asks me to update compatible browser, and after i update the browsers i have , i'm still getting the same thing .

     
    • Christopher Deckers

      On Windows, the default web browser engine is Internet Explorer which is now deprecated. If you use a recent version of the SWT library and if you use the latest preview of DJ Native Swing, you can force the use of the Edge runtime either by passing "JWebBrowser.useEdgeRuntime()" to the JWebBrowser constructor or using the system property "nativeswing.webbrowser.runtime=edge". That being said, the Edge runtime does not allow all the API of the JWebBrowser but it works well to view websites.

      Hope this helps,
      -Christopher

       
  • tahri haroune

    tahri haroune - 2023-07-05

    hi Christopher,

    I'd like to display google maps in panel on my java swing project, the first second the map appears and after that this windows ( the attatched picture ) appears and the maps disappears .. i still get the same problem after updating my browsers and setting microsoft edge the default browser.

    Thanks

     
    • Christopher Deckers

      As I indicated in my last post, you need to force the use of the Edge runtime on Windows. This can be done using a system property. Perhaps the problem is that you are not using the lastest preview version, older (and official) version did not support Edge.

       

Log in to post a comment.

MongoDB Logo MongoDB