Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: Using eclipse JRE 6.0 don't know what's wrong

  1. #1
    Junior Member
    Join Date
    Jan 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Using eclipse JRE 6.0 don't know what's wrong

    Error message is as follows : Exception in thread "main" java.lang.Error: Unresolved compilation problems:
    Scanner cannot be resolved to a type
    Scanner cannot be resolved to a type


    import java.util.scanner;
    import java.io.*;

    public class Areaofasquare2 {

    /**
    * @param args
    */
    public static void main(String[] args) {
    // TODO Auto-generated method stub
    Scanner input = new Scanner(System.in);
    System.out.print("Hi, This is a program to calculate Area of a Square");
    System.out.print("What is the length of the square");
    double length = input.nextDouble();
    System.out.print("What is the width of the square");
    double width= input.nextDouble();
    double area= width * length;
    System.out.print("The area of the square is");
    System.out.println (area);
    // TODO Auto-generated method stub
    }


  2. #2
    Member
    Join Date
    Jan 2012
    Posts
    107
    My Mood
    Grumpy
    Thanks
    6
    Thanked 2 Times in 1 Post

    Default Re: Using eclipse JRE 6.0 don't know what's wrong

    Have you considered Downloading Java API For eclipse?

  3. #3
    Member
    Join Date
    Jan 2012
    Posts
    107
    My Mood
    Grumpy
    Thanks
    6
    Thanked 2 Times in 1 Post

    Default Re: Using eclipse JRE 6.0 don't know what's wrong

    I Recommend Using Eclipse IDE for Java EE Developers The Download Can Be Fount On Eclipse.org

    Its what i use and it's Flawless.

  4. #4
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: Using eclipse JRE 6.0 don't know what's wrong

    Quote Originally Posted by ehren101 View Post
    Error message is as follows : Exception in thread "main" java.lang.Error: Unresolved compilation problems:
    Scanner cannot be resolved to a type
    Scanner cannot be resolved to a type


    import java.util.scanner;
    import java.io.*;

    public class Areaofasquare2 {

    /**
    * @param args
    */
    public static void main(String[] args) {
    // TODO Auto-generated method stub
    Scanner input = new Scanner(System.in);
    System.out.print("Hi, This is a program to calculate Area of a Square");
    System.out.print("What is the length of the square");
    double length = input.nextDouble();
    System.out.print("What is the width of the square");
    double width= input.nextDouble();
    double area= width * length;
    System.out.print("The area of the square is");
    System.out.println (area);
    // TODO Auto-generated method stub
    }
    It's Scanner not scanner.

  5. #5
    Junior Member
    Join Date
    Jan 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Using eclipse JRE 6.0 don't know what's wrong

    Changed the scanner to Scanner and it says

    Exception in thread "main" java.lang.Error: Unresolved compilation problem:

    at Areaofasquare2.main(Areaofasquare2.java:8)

  6. #6
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: Using eclipse JRE 6.0 don't know what's wrong

    Your class is unable to compile because there is no compiler to compile the class. JRE!=JDK. JRE is runtime environment but JDK is a development Kit. I am not sure if Eclipse JRE6.0 provides compiler or the development kit.

Similar Threads

  1. Replies: 24
    Last Post: August 4th, 2014, 01:49 PM
  2. What is wrong with my code? JAVA-Eclipse
    By bespinoz in forum Loops & Control Statements
    Replies: 9
    Last Post: November 17th, 2012, 04:06 PM
  3. Beginners Eclipse Tutorial. How to run first java application on Eclipse?
    By JavaPF in forum Java Code Snippets and Tutorials
    Replies: 13
    Last Post: June 24th, 2011, 01:26 AM
  4. Replies: 0
    Last Post: April 15th, 2011, 04:51 PM