Once and for all somebody, explain how to correctly access resources like DATABASE, HTML files and so on.
Suppose my Maven JavaFX project looks something like this (check the image).
It has it's
src/main/java
and
src/main/resources
in the Build Path
Inside resources I have a folder with a database and a folder with a html file.
Here is how I access the database and it works when I run it inside the IDE, but doesn't work after packaging or running the .exe file after mvn native
Class.forName("org.sqlite.JDBC");
c = DriverManager.getConnection("jdbc:sqlite:src/main/resources/DB/SeeYourUse.sqlite");
Here is how I access my HTML file to use it in a WebView
String url = Main.class.getResource("/HTML/help.html").toExternalForm();
webEngine.load(url);
And it DOES work inside the IDE (jfx:run and running as java application as well), but not a chance to run it after the deployment.
Here is the error I get when I run it and log it.
java.sql.SQLException: path to 'src/main/resources/DB/SeeYourUse.sqlite': 'E:\Programming\Java\Work\SeeYourUse\target\jfx\native\SeeYourUse-0.0.1-SNAPSHOT\app\src' does not exist
The QUESTION is: How do I properly load the database and the HTML to be able to use it at maximum?