Saving ArrayList into .txt file - Java -


i'm trying convert arraylist .txt file of own class (admin) , superclass (users). i'm saving data name, surname, antiquity , stuff via joptionpane requested in main.

so far i've done this, problem function stops working right before writeobject.

does not pop sort of error, de try catch joptionpane , i'm kinda stuck, appreciate help.

    public static void save_txt() {     string path = null;     try {         file f;         jfilechooser filechooser = new jfilechooser();         int seleccion = filechooser.showsavedialog(null);         if (seleccion == jfilechooser.approve_option) {             file jfc = filechooser.getselectedfile();             path = jfc.getabsolutepath();             path = path + ".txt";             f = new file(path);             fileoutputstream fo = new fileoutputstream(f);             objectoutputstream o = new objectoutputstream(fo);             /**              * ---stops working there---              */             o.writeobject(singleton.aladmin);             o.close();             joptionpane.showmessagedialog(null, "txt file saved correctly", "txt file",                     joptionpane.information_message);         }     } catch (exception e) {         joptionpane.showmessagedialog(null, "error saving txt", "error", joptionpane.error_message);     } } 


Comments