Java not saving Object on disk

aureagle

Registered
I had been programming a system that takes inputs from user and saves them to the hard disk. I use ObjectWriter to write the whole serializable class. But Mac is not saving the data any more. The program is working fine on other systems. Can anyone help me please

Code:
		try
		{
		FileOutputStream fos = new FileOutputStream("saved.db");
		GZIPOutputStream gzos = new GZIPOutputStream(fos);
		ObjectOutputStream out = new ObjectOutputStream(gzos);
		out.writeObject(this);
		//WriteAllObjects(out);
		out.flush();
		gzos.flush();
		fos.flush();
		out.close();
		gzos.close();
		fos.close();
		
		}
		catch(Exception e)
		{
			//System.out.println(e);
			ErrorPage(e);
		}

the only modifications I made were introducing some JTextAreas and used BoxLayout at some places (I had been using GridLayout previously)
 
Have you tried to output some object that is serializable for sure, like a double or int? That way you can check where the problem is (you said you made some changes to the class).
 
Where are you writing the file to? Could it be that you're trying to write a file to a directory in which you do not have permission to write?
 
Back
Top