问题
I'm building a project with Derby DB It works just fine when I run it in Netbeans and also as jar file when I use DB as Network Client with derbyclient.jar. But the problem is I have to distribute it so I use Embedded mode of Derby DB, As I provide derby.jar. And followed the instructions Provided Here. The only deference between Embedded & Network is we have to use this DB path (short DB name path)
dbPath = "jdbc:derby:Mail_Client_Ref_Fiverr";
Instead of (full with localhost and port)
dbPath = "jdbc:derby://localhost:1527/Mail_Client_Ref_Fiverr";
And in Class.forName (EmbeddedDriver)
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
Instead of (ClientDriver)
Class.forName("org.apache.derby.jdbc.ClientDriver");
But Its not working even on my own Laptop. I also tried it on my friend's laptop the problem is same.
I'm using Java 8u121 and its JavaFX project. Help me understand why its not working.
When I double-click on jar file it show a context manu with 3 options
- Java(TM) Platform SE binary
- Java Plateform SE binary
- WinRAR
In networking mode when I click on the 1st option above it works. But in Embedded mode it does not work at all.
Edit: When I execute with 1st option it through db connection error. With 2nd option it says unable to install java.
来源:https://stackoverflow.com/questions/42953665/jar-file-does-not-execute-with-db-connection