I am trying to get a Console using System.console() method,
but it returns null. Please let me know how to get a Console object?
Is their other criteria need to be satisfied?
java_programmer
0
Junior Poster
Recommended Answers
Jump to PostDid you read the API doc? It says:
Returns the unique Console object associated with the current Java virtual machine, if any.
I assume the "if any" means there might not be a console.
Why do you think there is a console for the JVM?
There wouldn't be if …
Jump to PostDo you mean you try to get another windonw ? Did you use javaw on DOS? If so there would be no console available so that no printed output on screen. But how do you know the System.console() returns null?
All 6 Replies
NormR1
563
Posting Sage
Team Colleague
tong1
22
Posting Whiz
java_programmer
0
Junior Poster
NormR1
563
Posting Sage
Team Colleague
java_programmer
0
Junior Poster
NormR1
563
Posting Sage
Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.