简体   繁体   English

Java applet不再调用public static void main()

[英]Java applet does not call public static void main() anymore

I have an applet that was originally built with JBuilder long time ago. 我有一个最初使用JBuilder建立的applet。 I believe it worked fine until fairly recently. 我相信直到最近它才能正常工作。 It has stopped working. 它已停止工作。 I have imported it to Eclipse to debug, and found that public static void main() is not called. 我已将其导入Eclipse进行调试,并发现未调用public static void main() This can explain the applet's crash. 这可以解释applet的崩溃。

My hunch is that the newer JVM does not call public static void main() for applets. 我的预感是,较新的JVM不会为applet调用public static void main() Could anyone shed some light on this? 谁能对此有所了解?

Java Applets require the applet lifecycle . Java Applet需要applet生命周期 There isn't any main for an applet. applet没有任何main

The main() method is normally used for applications. main()方法通常用于应用程序。 Any calls that you need to make at initialisation time should really be placed in: 您在初始化时需要进行的任何调用都应该放在:

public void init()

in your applet. 在您的小程序中。

My hunch is that the newer JVM does not call public static void main() for applets. 我的预感是,较新的JVM不会为applet调用public static void main()。 Could anyone shed some light on this? 谁能对此有所了解?

To my knowledge dating back to 1997, no VM has ever called main() for applets. 据我所知,可以追溯到1997年, 没有 VM曾经为applet调用main()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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