Menu

#14 use XULRunner runtime in dj lib

v1.0_(example)
open
nobody
xulrunner (1)
1
2014-11-01
2014-10-22
Mr Lee
No

Hi Christopher,

I wanna use Xulrunner runtime in my project. I do it in some steps below but not work.

  • Download xulrunner runtime in mozilla site (http://ftp.mozilla.org/pub/mozilla.org/xulrunner/releases/34.0b2/) and put xulrunner folder in "C:\xulrunner"

  • Set system properties in java code

System.setProperty("-Dnativeswing.webbrowser.runtime", "xulrunner");
System.setProperty("-Dnativeswing.webbrowser.xulrunner.home", "C:\xulrunner");
NativeInterface.open();
String str_url = "http://ip-address-here:8080/contact_online/login.jsp";
JWebBrowser webBrowser = new JWebBrowser(JWebBrowser.useXULRunnerRuntime());

  • but Exception here:

java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
...
Caused by: java.lang.reflect.InvocationTargetException
...
Caused by: org.eclipse.swt.SWTError: No more handles [Could not detect registered XULRunner to use]
at org.eclipse.swt.SWT.error(Unknown Source)
at org.eclipse.swt.browser.Mozilla.create(Unknown Source)
at org.eclipse.swt.browser.Browser.<init>(Unknown Source)
at chrriis.dj.nativeswing.swtimpl.components.core.NativeWebBrowser.createControl(NativeWebBrowser.java:431)

What's wrong in my steps? Do you have any suggestion for my issue?
This code run with xulrunnuer install version 1.9.x, but it's only matching with Firefox 5.0.

Discussion

  • Christopher Deckers

    Hi,

    You should either call your program with:
    java -jar xxxxxx "-Dnativeswing.webbrowser.runtime=xulrunner" "-Dnativeswing.webbrowser.xulrunner.home=C:\xulrunner"

    or set the system properties in code like this:
    System.setProperty("nativeswing.webbrowser.runtime", "xulrunner");
    System.setProperty("nativeswing.webbrowser.xulrunner.home", "C:\xulrunner");

    Hope this helps,
    -Christopher

     
  • Mr Lee

    Mr Lee - 2014-10-27

    Hi Christopher,

    Thank you so much.
    I set system property but its just work on some Xulrunner's version xulrunner-10.0.en-US.win32, xulrunner-24.0.en-US.win32. Other version error with missing dll or something...

    So, The newest DJ Native Swing (DJNativeSwing-SWT-1-0-3) compatible with newest Xulrunner (version 34.0b3)?

    I wanna use Handling the Custom URI Scheme in Xulrunner but its not work (http://msdn.microsoft.com/en-us/library/ie/aa767914(v=vs.85).aspx). So, the xulrunner not support for this. It look like the hyper link on web for skype or yahoo msg.

    Thanks,

     
  • Christopher Deckers

    Hi,

    DJ Native Swing integrates native web browser using the SWT library. Updating SWT to more recent version allows to support newer versions of XULRunner.

    Hope this helps,
    -Christopher

     

Log in to post a comment.