简体   繁体   中英

Why am I getting “no main class found”?

I simply tried running a simple Java applet using extends Applet and extends JApplet too as suggested when I searched for it on Google. I am still getting the error:

no main class found

How can I resolve this?

Applets don't have a main method, you need to load applets by appletviewer or in a browser

for example:

<APPLET CODEBASE="../classes/" ARCHIVE="your_jar.jar" 
         CODE=DemoApplet.class WIDTH=140 HEIGHT=45>
    <PARAM NAME="HELPURL" VALUE="help.htm">
</APPLET>

Remebemer java.awt.Applet需要runpaintdestroy方法,我很久以前在ReadyToProgram上测试了一些Applets

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