Reading text from console

HI,

So I'm trying to read text in from the console. It works fine in eclipse but when i create a jar file and run it on the console of my computer it crashes every time it gets to the read in part.

Here is the problem code

try {

BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

city = in.readLine();

}catch (IOException e) {

}

thanks,

andy

[428 byte] By [sleepyaindriua] at [2007-11-27 1:32:10]
# 1
The posted part of your code has no problem.
hiwaa at 2007-7-12 0:36:06 > top of Java-index,Java Essentials,New To Java...
# 2

that's my problem, it only seems to be an issue running the jar file in my console outside of eclipse. In eclipse it runs perfectly, can't see why it only runs in the eclipse console though. If any one has any ideas let me know. I have to submit the code and a jar file on friday afternoon.

thanks,

aindriu

sleepyaindriua at 2007-7-12 0:36:06 > top of Java-index,Java Essentials,New To Java...
# 3

If it helps at all it is telling me the error is after my try catch statement but there has been no input at this stage because it doesn't wait for input it just throws up the error. Incase your wondering about my code after the try catch it works fine when i give the program input before i compile the program instead of reading it in.

aindriu

sleepyaindriua at 2007-7-12 0:36:07 > top of Java-index,Java Essentials,New To Java...
# 4

All of what you've posted is meaningless, as far as trying to resolve a problem.

Is Java producing an error message? If so, post the EXACT and full text of the error. If it references a program line number, post enough of your code so that we can make sense of it (not more than 20 or so lines), and identify WHICH line is the one referenced in the error.

If Java is not producing an error, try to clearly explain what you're doing and using, what is happening. and EXACT results.

ChuckBinga at 2007-7-12 0:36:07 > top of Java-index,Java Essentials,New To Java...