300+ free and legal portable apps (over 9GB), up-to-date, & new apps regularly (Mar 8: LazPaint image editor).
Get the encrypted PortableApps.com Carbide, the fast PortableApps.com Companion, or carry your KeyZ.
PortableApps.com lead developer surgery/recovery, release slowdown (Latest News Dec 22nd)

# jPortable Launcher: Pass arguments

sep - December 4, 2011 - 8:21pm

Using the jPortable Launcher, I am able launch a .jar file using the following syntax:

C:\path\to\JavaPortableLauncher.exe C:\path\to\file.jar

This seems to work as if the following was done from a machine with a localized JVM:

java -jar C:\path\to\file.jar

Sometimes a .jar file needs additional arguments entered for it to work properly. If I add the arguments straight after the path to the .jar file, the launcher treats the arguments as part of the path and says that the .jar file cannot be found.

So my question is: Is it possible to pass arguments with the jPortable Launcher?

( categories: )

### Jar file

arguments can be run from the applauncher .ini I have a few apps that I did this with.

For instance this is a launcher I created for jajuk

[Launch]
ProgramExecutable=javaw.exe

CommandLineArguments=-client -Xms20M -Xmx512M -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 -jar %PAL:AppDir%\Jajuk\bin\jajuk.jar -notest
;
[Activate]
Java=require

[FilesMove]
settings\.jajuk_bootstrap=%USERPROFILE%

“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” Dr. Seuss

### A bit more

Note that the jPortable Launcher does a little bit more: it puts -Duser.home="$EXEDIR\Data\AppData" (which will cause the settings of many Java apps to be preserved) in the command line as well and sets the APPDATA environment variable to$EXEDIR\Data\AppData (which will do the same for a small number of Java apps).

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

### Not sure

If I did wrong or not. Was just giving him an alternative method

Back to my corner couch

“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” Dr. Seuss

I'm merely adding to it. It's worth investigating in general whether either of these techniques will be useful.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

### An example??

Does this still work and please could you provide a more specific example.
Applying some intuition i tried to put arguments in JavaPortableLauncher.ini (or should i create applauncher.ini and do smth with it) like this:

[Launch]
ProgramExecutable=javaw.exe
CommandLineArguments=-jar "D:\Documents and Settings\Administrator\Desktop\Upnp portmapper\PortMapper-1.9.5 .jar" -r 21 TCP
;
[Activate]
Java=require

And it doesn't work.

Thanks.

### Need more explanation

Me too, I've tried above tricks to run microemulator and arguments are needed to implement JSR-75 for example and it doesn't work.
Normally, if JRE is installed in computer, i do it like this and it works perfectly:
C:\windows\system32\java.exe -cp microemulator.jar;lib/microemu-jsr-75.jar org.microemu.app.Main --impl org.microemu.cldc.file.FileSystem org.microemu.examples.fcview.FCViewMidlet apps\operamini.jar

Where to put the inifile? And what is the name of inifile to create?

Thanks

### Errant space?

If you copied your launcher exactly, then it's possible you might have a space that is messing it up. Namely, "PortMapper-1.9.5 .jar" should probably be "PortMapper-1.9.5.jar" assuming the rest of the path is correct.

### No "CommandLineArguments" argument available

Using jPortable Launcher (http://portableapps.com/apps/utilities/java_portable_launcher) v3.0 I haven't found any way to add the "CommandLineArguments" arguments with those JVM arguments, so I patched jPortable Launcher v3.0 to be able to use a JAVA_OPTS environment variable to set JVM arguments, patched version at https://blobfish.atlassian.net/wiki/display/WEB/2014/03/07/jPortable+Lau...