views:

311

answers:

3

I'm trying to use this tool

https://swingexplorer.dev.java.net/

to find some information out about an applet's swing structure. Unfortunately, I didn't develop the applet. I've pulled the jars for the applet from the cache, but there are several hundred .class files in the jars, and I don't know which one has the main method.

Is there a way to pinpoint the applet's entry point? The browser must be able to figure it out to run the applet, so that information has to be somewhere in the jar (or maybe the .idx files that were in the same directory with the jars).

Ideas appreciated.

+1  A: 

The entry class will either be in the applet tag, or JNLP for new plugin JRE 6u10+ applets. You should be able to see which one it is from the jar alone by grepping for referecnes to the Applet or JApplet classes or, say, the init()V method.

Tom Hawtin - tackline
So an applet starts with an init() method and not a main method? I found a JApplet but it doesn't have a main method, which Swing Explorer requires. How do you grep .class files for methods?
Nathan Spears
You can introspect classes using various class browsing tools (Google), tools like javap (in the JDK) or the expedient method of just adding them to an IDE project classpath (such as Eclipse).
McDowell
The applet container calls a number of methods on the applet instance, and also of course calls the the entry class' no-args constructor. init is the most likely one to be implemented. Use your favourite grep tool to grep binary files - grep -R on the exploded archive on Linux.
Tom Hawtin - tackline
+2  A: 

The lifecycle of an Applet (or JApplet) is more complicated than start and run until the program is finished. It will be managed by the browser (lifecycle tutorial). This class is specified via applet/object/embed tags (deployment tutorial).

McDowell
A: 

I was trying to use the wrong tool for the task.

Nathan Spears