Ok, i have read alot about this bugs now, and nothing seems to help. Hope someone have a step by step solution for me, or atleast can give me some more insight hehe ;)

Here is a few intel on my work.
Im working in netbeans on my labtop, uploading the .java files to an linux server, compiling, and running there.
.java and .class files are in same directory.
i have tried writing :
java -classpath . home/.../../../Main/Main
java -classpath . home/.../../../Main/Main.class

Here is my Error messages:

dana@scylla:~/public_html/andersApplet/Main$ java Main.class
Exception in thread "main" java.lang.NoClassDefFoundError: Main/class
Caused by: java.lang.ClassNotFoundException: Main.class
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: Main.class.  Program will exit.

Here is my Code:

/**
 *
 * @author AndersM
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Board board = new Board();
        board.testthis();
    }

}

For the start Applet hasn't got main() method as you know from console or GUI applications. Have look at The Life Cycle of an Applet and here you can learn more on Applets if it is what you are after...

i know, this is the server i am creating so i can get data from another server, since it would create policy errors if i tried to connect directly to another ip then the one i am loading the applet from :) thats what i have been told for sure? :-)

noone to help?

As you have it described, simply java Main should work just fine. You do not need to include the ".class" part. In fact, when the "java" command sees the ".", it assumes that is a package designation, which is why it is trying to find "Main/class".

i know, this is the server i am creating so i can get data from another server, since it would create policy errors if i tried to connect directly to another ip then the one i am loading the applet from :) thats what i have been told for sure? :-)

noone to help?

I guess not because above is confusing statement. You creating server????

I guess not because above is confusing statement. You creating server????

i am creating a connectiong from the applet to the server, and i am making that program which should run on the server right now.
does that clarify it abit?

Thanks man, cant believe it to be that simple, but so far it looks to be solved thanks alot.

But then we are back to beginning where I said there is no main() method in applet.
Secondly what sort of connection from applet to server? What sort of server (database, web or application server)

Ezzaral, AMetnik already made one post in regards of above issue yesterday, claiming above code is part of Applet (see here). Now this is creating confusion...

Threads merged. Hopefully I didn't cause more confusion.

Thanx John

still peter, you are talking about stuff that doesnt matter.
It is not an applet related exception which i also tried to explain to you. but am very happy with ezzarals answer which seems to work.

So much for grateful thank you. Next time make sure you provide full facts as not to cause another misunderstanding of what you try to do...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.