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 4 of 4

Thread: beginner error

  1. #1
    Junior Member
    Join Date
    Jul 2014
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default beginner error

    . Hello, I'm new with programming, and new with Java. If someone can help me I will be gratefull. How can I solve this error:
    Error: Could not find or load main class javaapplication1.JavaApplication1
    Java Result: 1
    and the code is:

    import java.util.Scanner;

    class JavaApplication1{

    public static void main(String[] args) {

    scanner input = new scanner(System.in);
    int total = 0;
    int grade;
    int average;
    int counter =0;
    while(counter < 10){
    grade = input.nextInt();
    total = total+grade;
    counter++;

    }
    average = total/10;
    system.out.println("your average is" +average);

    }
    }

    Thank you!


  2. #2
    Member Ada Lovelace's Avatar
    Join Date
    May 2014
    Location
    South England UK
    Posts
    414
    My Mood
    Angelic
    Thanks
    27
    Thanked 61 Times in 55 Posts

    Default Re: beginner error

    Scanner and System should begin with uppercase characters.

    In regards to the actual problem, it could be an environment path error. Check
    the execution path (should be an option in the project properties menu). You
    have defined main correctly, so it is not a program problem. If the directory and
    paths seem ok, try running the code on another IDE (if you have one that is), if
    you still get the same problem, try Google in regards to your particular environment
    of choice.

    Wishes Ada xx
    If to Err is human - then programmers are most human of us all.
    "The Analytical Engine offers a new, a vast, and a powerful language . . .
    for the purposes of mankind
    ."
    Augusta Ada Byron, Lady Lovelace (1851)

  3. #3
    Junior Member
    Join Date
    Jul 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: beginner error

    It seems to me that you need a package statement.
    Before your import statement try adding this line

    package javaapplication1;

  4. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: beginner error

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for new members.

    Please post your code correctly using code or highlight tags which are explained near the top of the above link.

Similar Threads

  1. Hey! can anyone help me . i cant find an error (beginner)
    By fredsilvester93 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: July 19th, 2012, 08:25 AM
  2. Cannot find Error in Beginner code!
    By bankoscarpa in forum What's Wrong With My Code?
    Replies: 1
    Last Post: May 2nd, 2012, 08:44 PM
  3. Beginner: Error with 'extends JApplet'
    By chrisob in forum AWT / Java Swing
    Replies: 4
    Last Post: April 17th, 2012, 01:23 PM
  4. Beginner, Reading from file error
    By Lynce in forum File I/O & Other I/O Streams
    Replies: 2
    Last Post: October 27th, 2011, 06:31 AM
  5. error with a java game..(beginner)
    By Skat in forum What's Wrong With My Code?
    Replies: 3
    Last Post: November 1st, 2010, 02:04 PM