Did 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 the code were executed with the javaw command.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
How did you start its execution?
Did you open a command prompt window and enter the java command there or how?
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
But it did not run successfully -
You'll need to copy and paste the contents of the command prompt screen here to get
help.
To copy the contents of the command prompt window:
Click on Icon in upper left corner
Select Edit
Select 'Select All' - The selection will show
Click in upper left again
Select Edit and click 'Copy'
Paste here.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16