Wednesday, February 18, 2004

Re: Code Review

as mohn pointed out, in java jar files are used to package applications. actually jar files are just glorified zip files with a slightly different compression.

in java i can execute a jar file directly. by the command
$ java -jar MyJarApp.jar

inside the jar packages there exists a manifest file. the manifest file declares the entry-point or main method containing class. this class is executed first.

there are no exe's or dll's in java. for java apps, generally batch or/and shell files are used so that the client does not have to actually java. i have noticed many apps which provide both batch(.bat for win) and shell scripts(.sh for *nix). sometimes exe files are created which spawn java processes. but this is platform dependent.

also for gui based apps it is very odd for a cmd/shell window running in the background in which the java command was given. so there also exists a javaw command which will start the gui app without the cmd window. to try jar and javaw try the following
goto j2sdk install dir
there goto demo>>jfc>>Stylepad
$ javaw -jar Stylepad.jar

i feel that this(jar packages) is a problem for desktop apps. but for server apps its fine. these problems are further magnified as in java each class is in a seperate file. (which i think is not the case for .net). in libapp i have extensively used inner classes for all gui widget handlers. so i think the class file count reaches about 100, which is a lot.

metadata has been introduced in java 1.5. i do not know if metadata will change this scenario. mohn could tell us more on .net packaging, and probably a lot more on meta-data.

by the way, jar == java-archive. for j2ee, there also exist war and ear files. war == web-archive. a war file can be deployed within any j2ee compliant web server, and will run. war files mostly contain jsp's, servlets etc. ear == enterprise-archive. ear files can be deployed within application servers. ear files mostly contain ejb's.

No comments: