Help Reqd to place the Java Heap & Max Size in the program itself.
Hi,
I have a standalone application(jar file), which can be executed when double-clicked from windows. Now the problem I'm facing is when I need to process large txt files using this application. The program throws up a memory exception. I have overcome this problem by using the command line = "java -Xmx256m -Xms256m <class file name>". But this is nerve breaking everytime wherein I need to type this command line code.
What I want exactly is, does anyone know a way wherein I can increase the JVM memory as soon as the application is double-clicked from the desktop(without going thru the command line.). Is there any line of code, which I can incorporate my program so that the memory is boosted up 256 MB initially itself.
Wud be really gratefull for help. Thank y'all in advance.
[819 byte] By [
sachin.sa] at [2007-11-26 12:57:32]

# 1
I dont know wether this can really help or not, but just give a try.
Edit the registry entry ( use regedit from run )
change the value of the key HKEY_CLASSES_ROOT\jarfile\shell\open\command
from "C:\Program Files\Java\j2re1.4.2_08\bin\javaw.exe" -jar "%1" %*
to
"C:\Program Files\Java\j2re1.4.2_08\bin\java.exe <Your JVM heap >" -jar "%1" %*
thanks and regards
Renjith.
# 2
> What I want exactly is, does anyone know a way
> wherein I can increase the JVM memory as soon as the
> application is double-clicked from the
> desktop(without going thru the command line.). Is
> there any line of code, which I can incorporate my
> program so that the memory is boosted up 256 MB
> initially itself.
I know that you can not do specifically what you are asking.
Your choices are.
1. Write an installer to set it up that way.
2. Provide documentation to allow the user to manually set it.
3. Deliver it with OS specific code (not in java) which does that.
4. Write an OS specific wrapper (not in java) which does that.