Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

import java.io.Console cannot be resolved  RSS feed

 
raja kanak
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when i compile the following code

import java.io.Console;
import java.util.regex.Matcher;
....
....

error message was
The import java.io.Console cannot be resolved

i am using jre1.5.0_06
thanks in advance.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It means that there is no such class as Console in the java.io package. Take a look at the API for java.io and see for yourself.
 
raja kanak
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i saw this code snipet at
http://java.sun.com/docs/books/tutorial/essential/regex/test_harness.html

From there I conclude that in java.io package there must exists a class called Console. But why it is not compile.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
However, it is in Java 6.0: Console

Looks like Sun's Java Tutorial is getting ahead of SCJP 5.0.
 
raja kanak
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Barry Gaunt:
However, it is in Java 6.0: Console

Looks like Sun's Java Tutorial is getting ahead of SCJP 5.0.


that means with my current jre1.5.0_06 it wont compile, isnt it?
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by raja kvk:


that means with my current jre1.5.0_06 it wont compile, isnt it?



Um, no it won't, you need the jdk1.6.0. (by the way the jre does not compile, it's the JVM)
[ October 19, 2006: Message edited by: Barry Gaunt ]
 
raja kanak
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Barry Gaunt:



Um, no it won't, you need the jdk1.6.0. (by the way the jre does not compile, it's the JVM)

[ October 19, 2006: Message edited by: Barry Gaunt ]


Where can i get jdk1.6 ? i tried in www.sun.com but confused which one to download. guide me!
 
Muhammad Saifuddin
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just try this key word "download jdk1.6.0" on java.sun.com/google there you will found links regarding your.. query.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!