目前我已经将我的项目上传到我的svn上。 我也有其他用户访问此 svn 并下载该项目。 我目前遇到的问题是我必须提供我的WebEngine.load();
的绝对路径 我加载的html位于某个包下的eclipse项目中。 我正在尝试找到一种解决方案,其中不必提供绝对路径,而是提供html文件的相对路径。
我调用通过相对路径加载 html:
engine.load("file:///com.interpro.emmeclipse/src/com/interpro/emmeclipse/html/PageCreator.html");
相对路径:
/com.interpro.emmeclipse/src/com/interpro/emmeclipse/html/PageCreator.html
绝对路径:
C:Usersdparker.INTERPRODesktopemmeclipsesrccominterproemmeclipsehtmlPageCreator.html
试试这个:
engine.load(getClass()
.getResource("/com/interpro/emmeclipse/html/PageCreator.html")
.toExternalForm());
它也应该为JAR打包的应用程序运行,但无论如何都要测试它......
通过从源文件夹启动文件路径来解决。
engine.load(getClass().getResource("/src/com/interpro/emmeclipse/html/PageCreator.html").toExternalForm());