heap size -xms and -xmx definition on a per-app basis in manifest file?
Fernando Cassia
fcassia at gmail.com
Mon Sep 10 00:16:58 UTC 2012
I remember asking about many years ago... about the time of the Java 5.0
release or thereabouts...
I´d like being able to specify the -Xms and -Xmx parameters on the
meta-inf/manifest of my Java app.
That way, I wouldn´t have to create a native "launcher" or launch script
that invokes Java with the right apps. I´d expect the Java JRE to read the
manifest, and like it does to extract the default class, check if there´s a
parameter for -xms and -xmx and apply those parameters to the JRE before
starting the app.
The answer I got back then (on some forums, not sure if it was an
´official´ answer) was that it was impossible, because by the time the JVM
reads the manifest, the JVM has been already initialized. is this so?. and
if so, can the JVM be fixed to read those parameters from the manifest
BEFORE starting the JVM?.
In my book, the right way (TM) to deliver a Java app is as a single .jar,
with the default class specified in the manifest, and that the user should
be able to start it by double clicking on the .jar file (as happens on
windows) or "java -jar appname.jar" on Linux. So you´d agree that telling a
newbie to "type java -jar myapp.jar -Xms 1234 -XmX 2048" is not friendly
and could be avoided if the jre implemented parsing the jar before starting
the JVM... or if the JVM allowed reading such parameters from the manifest
and changed the JVM settings on-the-fly.
Well, after asking all this... I hope this isn´t an issue that has been
already adressed. ;-)
And if not, and you think this would be a good addition to the JVM, where
would I file a RFE? bugparade? the openjdk project?.
TIA,
FC
PS: It´s been a while since I thought about all of the above, so excuse me
if the parameters´ names are incorrect... it happened in 2004 or 2005, and
I was trying to repack someone else´s app on a single jar, and eliminate
the need for the custom launcher (which was a .sh / .cmd that called java
with the right memory limit parameters).
More information about the discuss
mailing list