I'm developing a project in Eclipse with SWT, where the interface is shown in a browser and for that, I use the XULRunner (Firefox) instead of using the standard browser.
I thought to compile the jar with the xurlrunner folder inside, so I created a source folder called "plugins" and copied the xurlrunner folder inside and got the path:
URL xulrunner = getClass().getClassLoader().getResource("xulrunner");
File file = new File(xulrunner.toURI());
System.setProperty("org.eclipse.swt.browser.DefaultType", "mozilla");
System.setProperty("org.eclipse.swt.browser.XULRunnerPath",
-> file.getAbsolutePath());
It worked, but only when run from within the Eclipse before exporting, however, the big problem is that when I export for a jar executable, the JVM can not load, of course, the reason is that file.getAbsolutePath()
could not point to into the jar.
For images, I use getResourceAsStream()
and it works very well once compiled, but when it is to transform a folder path inside the jar to String is that it is difficult.
QUESTION:
Is there any other way I can point to a folder into the jar that can be turned to String?
PROPOSAL
if there is no a way to keep the xurlrunner folder into the jar, I'll create an installer apart to extract it from a zip to the same location of the program installation and dynamically point to it.