javajava-web-startmainclass

How does Webstart determine the main class?


I have a jar file with two main classes. Depending on what I need I can run one or the other. To have this application run via webstart I created two JNLP files, each of them referencing one of the two main classes.

It is mindboggling to see that only one of the main classes is started from both files! What I know is the class that gets fired up is also the one listed as main-class in the jar's manifest. I tried to read the webstart specs, the webstart documentation but cannot find anything related to the manifest here. When I tried to look at the source code (shipped with the Oracle JDK) I did not see much related to the webstart launcher at all.

So how exactly does webstart find its main class?


Solution

  • In the JNLP file, you have a resource section where you put your jar.

    One of you jar should be main=true. In this jar you define the main-class in the MANIFEST.MF like a standalone jar file.