I have a set of help files for my SWT application that I have open in-application using the Browser
control. Navigation through the help files is done through hyperlinks of relative pathnames (i.e: <a href="aboutUs.htm">
, so only one html file is actually opened by java code, helpHome.htm. I am opening this using String homeURL = this.getClass().getResource("/help/helpHome.htm").toString();
and browser.setURL(homeURL);
This works beautifully when I'm just debugging it in Eclipse. Unfortunately, when I move the project into a .jar, the browser gives the standard "can't find this webpage" error. I've tried using the browser.setText(String);
function as described in this link, which works for helpHome.htm, but when I click a hyperlink, it brings me to a blank page displaying the relative pathname. Is there a way to convince browser to open an html file from an executable jar using the setURL(String)
method? If not, are there any suggested workarounds for me to achieve similar results?
Thanks in advance!!