Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

"java.io.IOException: The handle is invalid" in Win 2000

 
Eric Knapp
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am in instructor at a community college and I have many
students who can't get something to work under Windows 2000 with
jdk1.3. They are trying to perform a simple System.in.read() and
they get this:
java.io.IOException: The handle is invalid
at java.io.FileInputStream.readBytes(Native Method)
at java.io.FileInputStream.read(FileInputStream.java:183)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:186)
at java.io.BufferedInputStream.read(BufferedInputStream.java:204)
at Demo.main(Demo.java:8)
Exception in thread "main"
I can't reproduce this on my Linux box and the students in the
class who are running Windows 98 also are not having any
problems.
Can anyone help?
Thanks...
 
Phil Hanna
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post Demo.java?
------------------
Phil Hanna
Sun Certified Programmer for the Java 2 Platform
Author of :
JSP: The Complete Reference
Instant Java Servlets
Website: http://www.philhanna.com
 
Jayson Falkner
Author
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't remember the fix to this one off the top of my head, but I remember reading it on Sun's Java forums awhile ago. Do a search there and you should be able to find it.
Jayson Falkner
V.P./CTO, Amberjack Software LLC
Jayson@jspinsider.com
www.jspinsider.com
 
Eric Knapp
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Phil Hanna asked me to post the sample app that I used for this. Here it is:
public class Demo {

public static void main(String args[]) throws Exception {
char userInput;
int a = 2;
System.out.println("Please enter a character.");
userInput = (char) System.in.read();
System.in.read();
System.in.read();
System.out.println("You entered: " + userInput);
}
}

The class works just fine where ever I try it. I now have a Win 2000 setup and it works fine for me. Some of my students get the errors that I posted earlier on the first System.in.read().
-Eric
P.S. I guess this wasn't the correct forum for this. I'm new to JavaRanch.
 
Eric Knapp
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have searched every forum that I can find including the one at Sun and I have not been able to find the answer to this one. Any hints would be greatly appreciated!
Thanks,
-Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic