I have a Java project that uses Microsoft Access to store/retrieve data, and it works fine in both netbeans and the jar file. However, when I use launch4j to open/save data, nothing happens. I'm not sure if there's a way to get error messages from an exe, but if there is tell me how and I'll try to get it. Here is the code I use to open an Access file:
JFileChooser jfc = new JFileChooser();
jfc.setCurrentDirectory(new File("/home/me/Documents"));
int returnValue = jfc.showOpenDialog(null);
if (returnValue == JFileChooser.APPROVE_OPTION) {
File selectedFile = jfc.getSelectedFile();
String route = (selectedFile.getAbsolutePath());
try {
Statement statement;
ResultSet resultSet;
Connection connection=DriverManager.getConnection("jdbc:ucanaccess://"+route);
statement = connection.createStatement();
table.getColumns().clear();
resultSet = statement.executeQuery("SELECT * FROM Database");
values=0;
for ( int i = 0; i<table.getItems().size(); i++) {
a[i]=0;
b[i]=0;
table.getItems().clear();
}
int j=0;
table.getColumns().addAll(rowCol,aCol, bCol);
while(resultSet.next()) {
values = resultSet.getInt(1);
a[j] = resultSet.getDouble(2);
b[j] = resultSet.getDouble(3);
data.add(new info(a[j],b[j++],values));
}
// System.out.println(values);
}
catch (Exception ex ){
ex.printStackTrace();
}
}
Any help that could be offered would be greatly appreciated, thanks