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: Can't find javaclass

  1. #1
    Junior Member
    Join Date
    Sep 2013
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Can't find javaclass

    Hey guys, I have never had this error pop-up before compiling. It says it cannot find my javaaplication class...

    public static void main(String[] args)
    {
    double[] myList = { 5.0D, 4.4D, 1.9D, 2.9D, 3.4D, 2.9D, 3.5D };
    System.out.println("My list before sort is: ");
     
    printList(myList);
    bubbleSort(myList);
     
    System.out.println("My list after sort is: ");
    printList(myList);
    }
     
    static void printList(double[] list) {
    for (int i = 0; i < list.length; i++)
    System.out.println(list[i]);
    }
     
    static void bubbleSort(double[] list) {
    boolean changed = true;
    do {
    changed = false;
    for (int j = 0; j < list.length - 1; j++) {
    if (list[j] <= list[(j + 1)])
    continue;
    double temp = list[j];
    list[j] = list[(j + 1)];
    list[(j + 1)] = temp;
    changed = true;
    }
    }
    while (
    changed);
    }
    }

    Thanks for help

    --- Update ---

    package javaapplication18;
     
    /**
     *
     * @author Onlyname
     */
    public class JavaApplication18 {
     
        /**
         * @param args the command line arguments
         */
        public static double min(double[] array) {
            double[] myList = new double[10];
            java.util.Scanner input = new java.util.Scanner(System.in);
            System.out.print("Enter " + myList.length + " values: ");
            for (int i = 0; i < myList.length; i++)
                myList[i] = input.nextDouble();
            // TODO code application logic here
            double min = myList[0];
            for int(int i = 1; i < myList.length; i++){
                if (myList[i] > min) min = myList[i];
        }
            return min;
        }
    }

    Sorry first post was incorrect. This is the code with the problem.


  2. #2
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Can't find javaclass

    Always copy-paste the error message and post it with your code and question

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

    Default Re: Can't find javaclass

    There's something wrong in that the compiler is looking for a class called "javaaplication", but the class in the code you posted is called JavaApplication18. There might also be an issue with the way you've set up the files in the package. We'll know more after you post the exact error message - the whole thing - copied and pasted.

  4. #4
    Junior Member
    Join Date
    Sep 2013
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Can't find javaclass

    I am sorry guys, but I am not how I can do that. It only says <No main classes found>. I have never seen this error.

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

    Default Re: Can't find javaclass

    Are you running from the command line or in an IDE like Eclipse or Netbeans? If from the command line, paste the command you're using to compile the code.

  6. #6
    Junior Member
    Join Date
    Sep 2013
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Can't find javaclass

    I am using the IDE Netbeans. I tried to load a picture but website, just goes to a white page for me.

    --- Update ---

    I found what I've done wrong. I took out the "public static void main(String[] args)" by accident, so it wasn't finding that class at all. I added that line back in and it seems to be giving me plenty of other errors. SO it is working haha. Thanks.

Similar Threads

  1. cannot find symbol
    By lungelo in forum What's Wrong With My Code?
    Replies: 3
    Last Post: September 15th, 2013, 05:06 AM
  2. find a password
    By barbiie in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 8th, 2013, 02:04 AM
  3. Cannot find symbol
    By BadgerWatch in forum What's Wrong With My Code?
    Replies: 4
    Last Post: November 6th, 2011, 11:25 PM
  4. Cannot find Symbol?
    By defmetalhead in forum What's Wrong With My Code?
    Replies: 8
    Last Post: July 5th, 2011, 08:48 AM