I have a TreeeMap that i need to wite to file.
I tried this:

 try
         {
             File file = new File("reboot_customer_details");  
             FileOutputStream f = new FileOutputStream(file);  
             ObjectOutputStream s = new ObjectOutputStream(f);          
             s.writeObject(customerDetails);//customerDetails is the map i need to save
             s.close();
        }
         catch(Exception ex)
         {
             gui.results.setText("Error: " + ex);
         }

When i add a key/value pair to the map this is what it saves
¬í sr java.util.TreeMapÁö>-%jæ L
comparatort Ljava/util/Comparator;xppw t GLENsr rbdeskapp.Customer„ÀýËwz L namet Ljava/lang/String;L phoneq ~ L postq ~ L repairst Ljava/util/List;L streetq ~ L townq ~ xpt glent t sr java.util.ArrayListxÒ™Ça I sizexp w
sr rbdeskapp.Repair9¸B¹AªÎ L newlineq ~ L notesq ~ xpt
t NOTESxt llt x

What do I need to do?
Glen

That looks OK.
writeObject writes the Map and its contents in a binary format that only readObject understands.
If you want a readable version that can be used to write and read such Objects, take a look at XMLEncoder/XMLDecoder.
If you ust want a fully human-readable version then use ordinary print methods.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.