I am creating a Swing application with a JEditorPane
that should display an HTML file named url1.html
stored locally in the page folder in the root folder of the project.
I have instantiated the following String object
final String pagePath = "./page/";
and in order to be displayed by the JEditorPane
pane I have created the following URL object:
URL url1 = new URL("file:///"+pagePath+"url1.html");
However when the setPage()
method is called with the created URL object as a parameter:
pagePane.setPage(url1);
it throws me a java.io.FileNotFoundException
error.
It seems that there is something wrong with the way url1
has been constructed. Anyone knows a solution to this problem?