We package the Sphinx-4 demos as jar files. These can be easily run from the command line like so:

% java -jar HelloDigits.jar

Now, some of our demos can be quite large and require a heap that is larger than the default heap size. To run these demos the user has to invoke the jar file with a -mx option like so:

 % java -mx200m -jar HelloWorld.jar
This is just bonkers. Why should the user have to throw that switch? It is awkward for the user and requires more documentation by the developer. Since the developer knows how much memory the program needs, let the developer configure the app, don't make the user do the work.

Wouldn't it be great if you could put the Java command line options such as the "-mx200m" into the manifest in the jar file so it wouldn't be necessary to explicitly set the heap size option? You can do this sort of thing with Java WebStart JNLP files, but there's no equivalent mechanism for simple jar files. If we had this option we could eliminate a whole bunch of pesky documentation, make things easier for the user and reduce the possible failure modes for Java Apps.

Comments:

Why not use a launcher JAR? That is, a JAR that has classes in it that spawn another JVM instance as per the desired configuration? Running it would be only a little more complicated: java -jar DemoLauncher.jar HelloWorld

Posted by Robert Watkins on July 19, 2004 at 08:25 AM EDT #

Time to log an RFE - I can see your point...

Posted by Stephen Fitch on July 19, 2004 at 10:30 AM EDT #

Robert: Your suggestion isn't a very good workaround since it requires two (expensive!) JVM startups.

Posted by cp on July 19, 2004 at 03:55 PM EDT #

I suggest to check Roxes Ant Tasks (http://roxes.de/produkte/rat.html). It ships with the JStub task that creates a native Windows executable from a jar file. Since it allows you to specify command line switches, it should solve your problem.

Posted by Janek on July 20, 2004 at 05:18 AM EDT #

Janek - thanks for the suggestion, the Roxes stuff looks interesting, however, I rarely am targeting just win32 environements. I'm looking for a solution that works for win32, os x, solaris and linux.

Posted by Paul on July 20, 2004 at 05:26 AM EDT #

It should work for you anyway. From the documentation: "jstub creates native executables for Windows, MacOS X and almost any Unix System out of a working JAR archive. For Windows the executable command may contain placeholders for registry, enviroment and executable filename which are evaluated at runtime. The icon for the windows executable can be defined be the task."

Posted by Janek on July 20, 2004 at 06:05 AM EDT #

Post a Comment:
Comments are closed for this entry.

This blog copyright 2010 by plamere