Monday, January 12, 2009

Setting an Application's Entry Point

In the Java Tutorial, this lesson begins with the example:

Main-Class: MyPackage.MyClass

Notwithstanding all the work on packages in recent blogs, I'm still working with the jar file made from the version without a custom package assigned. But according to a recent post on the beginners' forum, if the class is in the default package, this line reads:

Main-Class: MyClass

Which in my case will be:

Main-Class: AMJFormA002

I have saved this line (with a carriage return at the end) in a file called entry.txt. Now I have to run the generic command

jar cfm MyJar.jar Manifest.txt MyPackage/*.class

Which in my case translates as:

jar cfm ActiveMathJA002.jar entry.txt *.class

Before doing this I note the the current jar file has the date Aug 31 08 (how time flies). There's a pause but no error messages when I run it. And sure enough the jar file date has changes. I'll just file away the expanded contents and run the extract command again to see what's in the new jar file. That looks good, and now the new manifest reads:

Manifest-Version: 1.0
Created-By: 1.6.0_03 (Sun Microsystems Inc.)
Main-Class: AMJFormA002

I believe at this point I am ready to try running the app.

No comments: