Estou precisando criar um metodo para serialização dos objetos de um container… Tentei fazer da seguinte forma:
public void serializar()
{
File file = new File("/bule/file/esboco.tmp");
if(!file.exists())
file.createNewFile();
FileOutputStream fileOut = new FileOutputStream(file);
ObjectOutputStream objOut = new ObjectOutputStream(fileOut);
objOut.writeObject("teste");
}
porém apresenta o seguinte erro:
Unreported exception java.io.IOException; must be caught or declared to be thrown
file.createNewFile();
Unreported exception java.io.IOException; must be caught or declared to be thrown
FileOutputStream fileOut = new FileOutputStream(file);
…
Tive um problema parecido pode ser este seu Hashtable, pode ser
que na hora de deserealizar ele não encontre a classe,
dae junto com o throws IOException coloque o ClassNotFound.