You are here

jPortable Launcher: Pass arguments

9 posts / 0 new
Last post
sep
Offline
Last seen: 3 years 5 months ago
Joined: 2011-12-04 19:10
jPortable Launcher: Pass arguments

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?

vf2nsr
vf2nsr's picture
Offline
Last seen: 13 hours 20 min ago
Developer
Joined: 2010-02-13 17:10
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

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 1 month 6 days ago
DeveloperModerator
Joined: 2007-04-15 21:08
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

vf2nsr
vf2nsr's picture
Offline
Last seen: 13 hours 20 min ago
Developer
Joined: 2010-02-13 17:10
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

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 1 month 6 days ago
DeveloperModerator
Joined: 2007-04-15 21:08
Adding

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

youdgin
Offline
Last seen: 1 year 7 months ago
Joined: 2012-01-29 11:56
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.

rtokyolivier
Offline
Last seen: 1 year 6 months ago
Joined: 2013-11-20 08:56
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

darksabre76
Offline
Last seen: 3 weeks 3 days ago
Developer
Joined: 2011-04-19 23:28
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.

hablutzel1
Offline
Last seen: 1 year 2 months ago
Joined: 2013-04-13 16:28
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...

Log in or register to post comments