So it turns out that I was getting that error because of connection to DB which was in void main for testing, but now I moved it on a button press:
con = DriverManager.getConnection(db, userDB, passDB);
The thing is, in Eclipse it is working fine, but in packed form, when I call that it just hangs, it doesn't advance. I did a little test around it and the status stays at "Starting connecting".
statusDB.setText("Starting connecting");
Thread thread = new Thread(new Runnable() {
public void run() {
try {
con = DriverManager.getConnection(db, userDB, passDB);
Platform.runLater(new Runnable() {
@Override
public void run() {
statusDB.setText("Connected");
}
});
} catch (Exception e) {
e.printStackTrace();
FunctionsCode.writeError(e);
con = null;
Platform.runLater(new Runnable() {
@Override
public void run() {
statusDB.setText("Failed");
}
});
}
}
});
thread.start();
I am using PostgreSQL. Why does it hang in packed form?