简体   繁体   中英

how to run Java applet in netbeans IDE without any main class

I just imported a project from eclipse workspce to Netbeans IDE and tried to run it.

But each time an error " Main Class not found " was produced .

Then, I enabled Webstart for my project and chose the Applet class option .

But the same problem continues....

Is there a way to run Java applets without main class???

My project contains a Java Applet and a Java panel(which is used by the applet) I want to run Japplet.java through netbeans....

You'll need a Main class if your (Netbeans) project is for a standalone application. If it's an Applet, you'll need to be provide an Applet class. A Main class is any class that has the following method:

public static void main(String[] args) {
    ... any code to initialize your application
}

An applet class is a class that extends the Applet class. Applets run in webbrowsers, but are rarely used nowadays. Webstart is also a way to run Java-applications from webbrowsers but also rarely used.

I assume you 'just' want to run an application: I'd suggest to add the main method to one of your classes.

You can also run it in netbeans

Right click --> yourJavaApplet.java --->Run File..

Try Running the project in Eclipse

Eclipse makes it easy to run Java applets.

Just Select yourJavaApplet.java or project and run it from toolbar. Or right-click yourJavaApplet.java ---> Run As--->Java Applet

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM