java.lang.NoClassDefFoundError: Main
Caused by: java.lang.ClassNotFoundException: Main
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: Main.  Program will exit.
Exception in thread "main" Java Result: 1

after i had done my system. this error message pop up and restricted me to launch my system. anyone here can give some advise so that i can solve this problem?

thanks

package PSMS1;

import PSMS.function.executeLookAndFeel;

public class Main {

    public static void main(String[] args) {
        new executeLookAndFeel().initLookAndFeel();
        LoginScreen ls = new LoginScreen();
        ls.setVisible(true);
    }
}

you mean this?

please check your classpath

as well as make the main method static

i think this is sufficient to run your program

the class path is correct
but i not so sure what you mean about make the main method into static?
sorry that im still a newbie

stupid post, ignore

your main method is static, im not sure why it wouldnt be working

Edited 6 Years Ago by hanvyj: n/a

stupid post, ignore

your main method is static, im not sure why it wouldnt be working

im sorry about the "stupid post"
but i really cant find the solution why it happens to my system.

The file name has to be the same name as the class - class Main has to reside in the file Main.java.

Edited 6 Years Ago by apines: n/a

okay guys i got it =D
i just found the solution. cause im using netbeans

just go into netbeats>right click and choose properties of the system folder>choose run>browse and choose the main to run the program.

Thanks everyone for the help!
thanks alot =D

yes, i finally got it =D
thanks guys for helping here.

solution:
(im using netbeans as IDE)
open netbeans> right click on the folder and choose properties> click run> browse the folder and re-select the main class.

that's it =D
once again, thanks!

im sorry about the "stupid post"
but i really cant find the solution why it happens to my system.

Sorry!!! I wasn't calling your post stupid! My reply was very stupid (I was telling you how to use a main method, because I mistook your main class as the method meaning it was upper case M and not static and didnt accept string args... ect ect

I realised my post was wrong and edited it deleting the contents an replacing it with stupid post. Then I edited it again because your main method was static and the poster above told you to make it static - this made my post more than just "stupid post, ignore" and made the meaning of that line a bit confusing i think...

Sorry again! Didn't intent do call your post stupid - I dont know the answer lol

This question has already been answered. Start a new discussion instead.