I am trying to create a Mac OS X application from java desktopos.jar, where is the file of my .jar application using derby, the built-in APPDATA database. This creates a problem when I create a Mac OS X.app application
Here is my java connection method (already running on .exe and setup-Windows and Linux)
public static Connection getdataconnet() {
Connection connect = null;
try {
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
connect = DriverManager.getConnection("jdbc:derby:APPDATA", "xxxx", "xxxxxxxxxxxxxxx");
} catch (ClassNotFoundException ex) {
globalData.GlobalDataSetGet.OLD_USER = -1;
} catch (SQLException ex) {
globalData.GlobalDataSetGet.OLD_USER = -1;
}
return connect;
}
Mac OS X.app Application Architecture

APPDATA not found .jar after creating Mac OS X.app application

Using CWD ..
Connection connect = null;
Path currentRelativePath = Paths.get("");
String s = currentRelativePath.toAbsolutePath().toString();
try {//DriverManager.getConnection("jdbc:derby:"+System.getProperty("user.dir")+"/APPDATA", "#####", "#############");
connect = DriverManager.getConnection("jdbc:derby:"+s+"/APPDATA", "#####", "#############");
} catch (ClassNotFoundException ex) {
globalData.GlobalDataSetGet.OLD_USER = -1;
JOptionPane.showMessageDialog(null, "1"+ex);
} catch (SQLException ex) {
globalData.GlobalDataSetGet.OLD_USER = -1;
JOptionPane.showMessageDialog(null, "2"+ex);
}
Need help, thanks!
user4856296
source
share