Can not set xulrunner path as system property
Web Browser, Flash Player, HTML editor, Media player for Swing and SWT
Brought to you by:
chrriis
I put xulrunner folder inside my project (in a folder called native). Now I'm trying to add xulrunner paths to the project as follows:
File xulRunner = new File("native//xulrunner");
System.setProperty("-Dnativeswing.webbrowser.runtime", "xulrunner");
System.setProperty("-Dnativeswing.webbrowser.xulrunner.home", xulRunner.getAbsolutePath());
It does not work, and I'm getting this error:
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at chrriis.dj.nativeswing.swtimpl.core.MessagingInterface.processCommandResult(MessagingInterface.java:342)
at chrriis.dj.nativeswing.swtimpl.core.MessagingInterface.syncSend(MessagingInterface.java:329)
at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface.syncSend_(SWTNativeInterface.java:392)
at chrriis.dj.nativeswing.swtimpl.NativeInterface.syncSend(NativeInterface.java:104)
It works, If I write the path as an absolute path which directs to the folder in my pc, like:
System.setProperty("-Dnativeswing.webbrowser.xulrunner.home", "C:/folder/folder/folder/projectfolder/native/xulrunner");
It is strange because I check the xulRunner.getAbsolutePath() value with debug and It has the same value with this path. But does not work.
Sorry I miswrote the last part.
This does not work either:
What I meant to write was that It works when I add this full path to the project VM Options:
I think you set your properties too late.
Try setting your properties before calling to NativeInterface.open()
well basicly the code goes like :
Hi,
Then maybe try setting the properties before calling
NativeInterface.initialize().If that does not work, set that code as first line of main method.
Hope this helps,
-Christopher
I'll try,but which path should I use.
I expect "native/xulrunner" to work normally. Do you confirm this ?
This method is the first thing I call in my main method:
Later when needed I call
NativeInterface.open();You don't have to put "-D" when using setProperty function so :
need to be replaced by :
Placing these before NativeInterface.open() and correction of -D solved my problem.
Thanks a lot for your time.