I've downloaded a Java applet project which consists of many .java files and can't understand how Java detects where the entry point is. Manifest does not contain any references to entry point. There are several classes containing main method, but logically they can't be entry points.

有帮助吗?

解决方案

According to your question "Entry point for java applet".

The life cycle of an applet is:

  1. init
  2. start
  3. stop
  4. destroy

So the entry point of an applet is init

其他提示

I would say it's the init() method of the class which extends applet

maybe have a look here : Java Applet runs without a main method?

Taken from Answers.com:

Applets run in the browser, and in this context the one in charge of the launch and execution of the applet is the Java Plug-in software in the browser. This plugin controls the applet life cycle through methods in our applet. These methods are init, start, stop and destroy. In this case the methods that the plugin search to begin the execution of the applet are init (to initialize itself) and start (to start the execution of the task in the applet).

In other words, there are multiple entry points and exit points. Init is the first to be called, so it could be thought of as the "first entry point". Your program gains control, loses control, regains control, etc. This is common in web programming, where page events are called and then the browser (the end user) regains control of the page.

Think of it like this: if your application always had control, how would a user interact with the applet?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top