»»

java.io errorsJava Runtime

Top patterns

  1. Unable to open file, file not found in the path provided

    Use the relative path when providing the location of the file. Place the file in the project folder and access it according to the hierarchy. If you want to access a file outside the project folder, provide the absolute path.

  2. Trying to write an object to a file/socket that is not serializable

    To ensure that you are able to write an object to a file/socket, make the object's class implement the Serializable interface

  3. Unable to create/append to file

    There could be quite a few reasons for this, check:

    • If the directory, in which the file is located, exists.
    • Whether you have write permissions for the file.
    • Whether you have directory write permissions.
    • Whether you have too many file handles open.
Error patternsClassesMethodsExceptions
DescriptionException TypeEntry MethodWeb pages

Unable to open file, file not found in the path provided

java.io.FileNotFoundException
java.io.FileInputStream.open
3545Web pages
1Solution
FileNotFoundExceptionFileInputStream.open3545

Trying to write an object to a file/socket that is not serializable

java.io.NotSerializableException
java.io.ObjectOutputStream.writeObject0
1380Web pages
1Solution
NotSerializableExceptionObjectOutputStream.writeObject01380

Unable to create/append to file

java.io.FileNotFoundException
java.io.FileOutputStream.open0
725Web pages
1Solution
FileNotFoundExceptionFileOutputStream.open0725

JRE unable to create file

java.io.IOException
java.io.UnixFileSystem.createFileExclusively
716Web pages
1Solution
IOExceptionUnixFileSystem.createFileExclusively716

File.<init>() has thrown a NullPointerException

java.lang.NullPointerException
java.io.File.<init>
624Web pages
NullPointerExceptionFile.<init>624

ObjectInputStream.readStreamHeader() has thrown a StreamCorruptedException

java.io.StreamCorruptedException
java.io.ObjectInputStream.readStreamHeader
553Web pages
1Solution
StreamCorruptedExceptionObjectInputStream.readStreamHeader553

FileOutputStream.writeBytes() has thrown an IOException

java.io.IOException
java.io.FileOutputStream.writeBytes
496Web pages
IOExceptionFileOutputStream.writeBytes496

ObjectStreamClass.initNonProxy() has thrown an InvalidClassException

java.io.InvalidClassException
java.io.ObjectStreamClass.initNonProxy
437Web pages
InvalidClassExceptionObjectStreamClass.initNonProxy437

DataInputStream.readInt() has thrown an EOFException

java.io.EOFException
java.io.DataInputStream.readInt
437Web pages
EOFExceptionDataInputStream.readInt437

File.<init>() has thrown an IllegalArgumentException

java.lang.IllegalArgumentException
java.io.File.<init>
411Web pages
IllegalArgumentExceptionFile.<init>411

Reader.<init>() has thrown a NullPointerException

java.lang.NullPointerException
java.io.Reader.<init>
398Web pages
NullPointerExceptionReader.<init>398

RandomAccessFile.open() has thrown a FileNotFoundException

java.io.FileNotFoundException
java.io.RandomAccessFile.open
389Web pages
FileNotFoundExceptionRandomAccessFile.open389

ObjectInputStream$PeekInputStream.readFully() has thrown an EOFException

java.io.EOFException
java.io.ObjectInputStream$PeekInputStream.readFully
387Web pages
EOFExceptionObjectInputStream$PeekInputStream.readFully387

ObjectInputStream$BlockDataInputStream.peekByte() has thrown an EOFException

java.io.EOFException
java.io.ObjectInputStream$BlockDataInputStream.peekByte
368Web pages
EOFExceptionObjectInputStream$BlockDataInputStream.peekByte368

DataInputStream.readFully() has thrown an EOFException

java.io.EOFException
java.io.DataInputStream.readFully
357Web pages
EOFExceptionDataInputStream.readFully357

FileInputStream.readBytes() has thrown an IOException

java.io.IOException
java.io.FileInputStream.readBytes
292Web pages
IOExceptionFileInputStream.readBytes292

FileOutputStream.openAppend() has thrown a FileNotFoundException

java.io.FileNotFoundException
java.io.FileOutputStream.openAppend
264Web pages
FileNotFoundExceptionFileOutputStream.openAppend264

ObjectInputStream.readObject0() has thrown a StreamCorruptedException

java.io.StreamCorruptedException
java.io.ObjectInputStream.readObject0
254Web pages
StreamCorruptedExceptionObjectInputStream.readObject0254

DataInputStream.readByte() has thrown an EOFException

java.io.EOFException
java.io.DataInputStream.readByte
207Web pages
EOFExceptionDataInputStream.readByte207

BufferedInputStream.getBufIfOpen() has thrown an IOException

java.io.IOException
java.io.BufferedInputStream.getBufIfOpen
190Web pages
IOExceptionBufferedInputStream.getBufIfOpen190

RandomAccessFile.writeBytes() has thrown an IOException

java.io.IOException
java.io.RandomAccessFile.writeBytes
190Web pages
IOExceptionRandomAccessFile.writeBytes190

StringReader.<init>() has thrown a NullPointerException

java.lang.NullPointerException
java.io.StringReader.<init>
189Web pages
NullPointerExceptionStringReader.<init>189

ObjectStreamClass$FieldReflector.setObjFieldValues() has thrown a ClassCastException

java.lang.ClassCastException
java.io.ObjectStreamClass$FieldReflector.setObjFieldValues
181Web pages
ClassCastExceptionObjectStreamClass$FieldReflector.setObjFieldValues181

Writer.write() has thrown a NullPointerException

java.lang.NullPointerException
java.io.Writer.write
169Web pages
NullPointerExceptionWriter.write169

DataInputStream.readUnsignedShort() has thrown an EOFException

java.io.EOFException
java.io.DataInputStream.readUnsignedShort
126Web pages
EOFExceptionDataInputStream.readUnsignedShort126

RandomAccessFile.open0() has thrown a FileNotFoundException

java.io.FileNotFoundException
java.io.RandomAccessFile.open0
115Web pages
FileNotFoundExceptionRandomAccessFile.open0115

DataInputStream.readUTF() has thrown an UTFDataFormatException

java.io.UTFDataFormatException
java.io.DataInputStream.readUTF
115Web pages
UTFDataFormatExceptionDataInputStream.readUTF115

ObjectOutputStream.outputObject() has thrown a NotSerializableException

java.io.NotSerializableException
java.io.ObjectOutputStream.outputObject
111Web pages
NotSerializableExceptionObjectOutputStream.outputObject111

FileInputStream.<init>() has thrown a NullPointerException

java.lang.NullPointerException
java.io.FileInputStream.<init>
109Web pages
NullPointerExceptionFileInputStream.<init>109

ByteArrayOutputStream.expand() has thrown an OutOfMemoryError

java.lang.OutOfMemoryError
java.io.ByteArrayOutputStream.expand
105Web pages
OutOfMemoryErrorByteArrayOutputStream.expand105

File.fixSlashes() has thrown a NullPointerException

java.lang.NullPointerException
java.io.File.fixSlashes
104Web pages
NullPointerExceptionFile.fixSlashes104

RandomAccessFile.seek() has thrown an IOException

java.io.IOException
java.io.RandomAccessFile.seek
103Web pages
IOExceptionRandomAccessFile.seek103

BufferedInputStream.getInIfOpen() has thrown an IOException

java.io.IOException
java.io.BufferedInputStream.getInIfOpen
100Web pages
IOExceptionBufferedInputStream.getInIfOpen100

ByteArrayInputStream.<init>() has thrown a NullPointerException

java.lang.NullPointerException
java.io.ByteArrayInputStream.<init>
98Web pages
NullPointerExceptionByteArrayInputStream.<init>98

ObjectInputStream$BlockDataInputStream.setBlockDataMode() has thrown an IllegalStateException

java.lang.IllegalStateException
java.io.ObjectInputStream$BlockDataInputStream.setBlockDataMode
89Web pages
IllegalStateExceptionObjectInputStream$BlockDataInputStream.setBlockDataMode89

ObjectOutputStream.writeNewObject() has thrown a NotSerializableException

java.io.NotSerializableException
java.io.ObjectOutputStream.writeNewObject
88Web pages
NotSerializableExceptionObjectOutputStream.writeNewObject88

DataInputStream.readUnsignedByte() has thrown an EOFException

java.io.EOFException
java.io.DataInputStream.readUnsignedByte
84Web pages
EOFExceptionDataInputStream.readUnsignedByte84

PipedInputStream.read() has thrown an IOException

java.io.IOException
java.io.PipedInputStream.read
83Web pages
IOExceptionPipedInputStream.read83

OutputStream.write() has thrown an IOException

java.io.IOException
1 frames hidden
java.io.OutputStream.write
72Web pages
IOExceptionOutputStream.write72

BufferedInputStream.read() has thrown an IndexOutOfBoundsException

java.lang.IndexOutOfBoundsException
java.io.BufferedInputStream.read
68Web pages
IndexOutOfBoundsExceptionBufferedInputStream.read68

PipedInputStream.checkStateForReceive() has thrown an IOException

java.io.IOException
java.io.PipedInputStream.checkStateForReceive
65Web pages
IOExceptionPipedInputStream.checkStateForReceive65

ObjectStreamClass.validateLocalClass() has thrown an InvalidClassException

java.io.InvalidClassException
java.io.ObjectStreamClass.validateLocalClass
63Web pages
InvalidClassExceptionObjectStreamClass.validateLocalClass63

FileInputStream.<init>() has thrown a FileNotFoundException

java.io.FileNotFoundException
java.io.FileInputStream.<init>
62Web pages
FileNotFoundExceptionFileInputStream.<init>62

ObjectInputStream.readObject0() has thrown an OptionalDataException

java.io.OptionalDataException
java.io.ObjectInputStream.readObject0
60Web pages
OptionalDataExceptionObjectInputStream.readObject060

BufferedWriter.ensureOpen() has thrown an IOException

java.io.IOException
java.io.BufferedWriter.ensureOpen
55Web pages
IOExceptionBufferedWriter.ensureOpen55

RandomAccessFile.readFully() has thrown an EOFException

java.io.EOFException
java.io.RandomAccessFile.readFully
54Web pages
EOFExceptionRandomAccessFile.readFully54

ObjectInputStream.readObject0() has thrown a WriteAbortedException

java.io.WriteAbortedException
java.io.ObjectInputStream.readObject0
54Web pages
WriteAbortedExceptionObjectInputStream.readObject054

RandomAccessFile.readInt() has thrown an EOFException

java.io.EOFException
java.io.RandomAccessFile.readInt
48Web pages
EOFExceptionRandomAccessFile.readInt48

BufferedReader.ensureOpen() has thrown an IOException

java.io.IOException
java.io.BufferedReader.ensureOpen
44Web pages
IOExceptionBufferedReader.ensureOpen44

File.createNewFile() has thrown an IOException

java.io.IOException
java.io.File.createNewFile
44Web pages
IOExceptionFile.createNewFile44
Nothing to list here.
Nothing to list here.
Nothing to list here.