Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Java.io.IOException: The handle is invalid

843810Oct 2 2002 — edited Oct 5 2002

I recently had to format my PC after data corruption, and
whe I reinstalled the Java SDK I found that certain programs
would no longer run after compiling. The problems seems to
be something to do with the input/output. I've tried
reinstalling Java without any luck. The error is this:


Is the boat ready for the journey(y for yes, n for not)?java.io.IOException: The handle is invalid
at java.io.FileInputStream.readBytes(Native Method)
at java.io.FileInputStream.read(FileInputStream.java:192)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
at Boat.performCheck(Ships.java:69)
at Ships.main(Ships.java:19)
Exception in thread "main" Exit code: 1
There were errors


And the code that seems to be affected:

void performCheck() throws IOException
{
char check;
System.out.print("Is the boat ready for the journey(y for yes, n for not)?");
check = (char)System.in.read();
System.in.skip(2);
if(check == 'y')
{
seaWorthy = true;
} // close if block
else
{
seaWorthy = false;
} // close else block
} // close performCheck method


I'm learning Java through a course with a deadline of
November, and this problem is really slowing me down.
Can anyone help? The code compiles without errors, it
just won't run.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 2 2002
Added on Oct 2 2002
3 comments
2,290 views