Results 1 to 4 of 4
  1. #1
    guitar-maniac is offline Member
    Join Date
    Jan 2010
    Posts
    2
    Rep Power
    0

    Default Ptoblems with eclipse and Scanner

    Hey! I'm using Eclipse on Ubuntu for coding Java. My java/javac version is 1.6. and on eclipse the JRE seems to be 1.5.

    Eclipse says it cannot resolve Scanner. i have imported it, and i pasted the code to my friends and the got it working without a prob. I ried compile the code from clipse and straight from console but it didn't work. Just complained about the Scanner. here's the code:

    import java.util.Scanner;

    public class test
    {
    public static void main(String[] args)
    {

    int luku;
    Scanner scan = new Scanner(System.in);

    System.out.println("Anna luku: ");
    luku = scan.nextInt();
    System.out.println("\n"+luku);
    }
    }

  2. #2
    checho is offline Member
    Join Date
    Jan 2010
    Posts
    14
    Rep Power
    0

    Default

    try cleaning the project, ot just restart eclipse

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    You may need to change Eclipse's JDK compliance level. Go to the following menus:

    Window
    Preferences
    Java
    Compiler

    Then change the Compiler compliance level to 1.6.

  4. #4
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,008
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by Fubarable View Post
    You may need to change Eclipse's JDK compliance level. Go to the following menus:

    Window
    Preferences
    Java
    Compiler

    Then change the Compiler compliance level to 1.6.
    Be very careful with that: it changes the compliance level of Eclipse's own compiler but if the supplied jre (Sun's stuff) doesn't match that compliance level all bets are off, e.g. if rt.jar doesn't contain a class Scanner the compiler still won't find it.

    kind regards,

    Jos

Similar Threads

  1. Help With Scanner
    By jtmoney0511 in forum New To Java
    Replies: 10
    Last Post: 10-12-2009, 11:24 PM
  2. Need help with scanner.
    By mainy in forum New To Java
    Replies: 3
    Last Post: 07-28-2009, 02:11 PM
  3. Scanner
    By choko in forum New To Java
    Replies: 10
    Last Post: 01-24-2009, 03:37 PM
  4. need help with scanner
    By whiterex in forum New To Java
    Replies: 1
    Last Post: 04-22-2008, 01:41 PM
  5. help with IP scanner
    By tommy in forum New To Java
    Replies: 1
    Last Post: 08-06-2007, 08:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •