Passing arguments to java vm from NSIS script

Posted by CodeBuddy on Stack Overflow See other posts from Stack Overflow or by CodeBuddy
Published on 2010-04-01T19:05:12Z Indexed on 2010/04/01 19:23 UTC
Read the original article Hit count: 299

Filed under:
|
|

I'm developing my first java application using Eclipse. I've recently needed to adjust the amount of memory allocated by passing -Xmx256M to the JVM. The application is currently package up as a runnable jar and installed using the NSIS.

I'm having a problem passing arguments to the jar file once its installed. What is the common practice for doing this? Here is what I'm currently doing in my nsi file:

CreateShortcut "$SMPROGRAMS\$StartMenuGroup\$(^Name).lnk" "$SYSDIR\javaw.exe" "-jar -Xmx256M $INSTDIR\Foo.jar"

This results in the following being created as the shortcut Target on windows:

C:\WINDOWS\system32\javaw.exe -jar -Xmx256M C:\Program Files\Foo\Foo.jar 

Unfortunately this does not work due to the space in C:\Program Files, If I change the link created manually to include quotes all is well:

C:\WINDOWS\system32\javaw.exe -jar -Xmx256M "C:\Program Files\Foo\Foo.jar"

© Stack Overflow or respective owner

Related posts about java

Related posts about nsis