Sunday, January 11, 2009

Checking the NetBeans jar file

I've noticed in the fora that when people using IDE tools run into difficulties there is a chorus from the crowd that they should learn to do it all manually before working with fancy tools. I have also noticed that NetBeans has produced a so-called executable jar file for me, but before trying to run it, I'll use the lessons to check out a few details.

First I'm just going to try out the code in the Viewing the Contents of a JAR File lesson to check the content of the jar file. The output is as follows:

META-INF/
META-INF/MANIFEST.MF
AMJFormA002$1.class
AMJFormA002$2.class
AMJFormA002.class
AMJQGenA002.class

I am curious that the jar file seems to include two early drafts of the main class. That's not a problem now (the file is still only 10kb) but it could become an issue in the future. Besides that everything seems to be there. A manifest seems to have been included although I am not sure what it says.

I'll now apply a code scrap from the lesson Extracting the Contents of a JAR File to check out the manifest. The files extract to the folder where I ran the code and the manifest extracts to the subfolder meta-inf. I open the manifest with a text editor and the contents are:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0
Created-By: 1.6.0_03-b05 (Sun Microsystems Inc.)
X-COMMENT: Main-Class will be added automatically by build

This is interesting, because according to the lesson Setting an Application's Entry Point, an entry point needs to be set. Why hasn't NetBeans done this? The last line could be a clue. Because the jar file existed, I assumed the build command had been executed when when I ran the app. I'll select build explicitly from the build menu and try again. No it hasn't made any difference. The last line was lying. Now I'll have to go through the tedious manual process outlined in the lesson.

No comments: