try { FileInputStream fileInputStream = new FileInputStream("C:\\temp\\foo"); ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream); objectInputStream.readObject(); } catch (Exception e) { e.printStackTrace(); }