Old 8th April 2020, 16:25   #1
Koque
Junior Member
 
Join Date: Apr 2020
Posts: 1
How execute .jar with arguments?

Hey!
I want to execute a .jar with arguments in the installation process with a NSIS Installer.
The command I want to execute in CMD or Powershell is: java -Xmx1024 my.jar --install .
I read about nsExec and only exec but I don't find a download for exec and I don't know how to make it with nsExec. I searched how to do it with nsExec, but my English is not the best in the world so sometimes I didn't understand what meant.

It would be great if anyone can tell me how it works!

Thank you in advance!
Koque is offline   Reply With Quote
Old 8th April 2020, 20:08   #2
Nutzzz
Member
 
Join Date: May 2007
Location: Orange County, CA, U.S.A.
Posts: 69
Exec is a built-in keyword
(as is ExecWait and ExecShell).

The nsExec plugin is included with NSIS. It also has 3 flavors:
nsExec::Exec or nsExec::ExecToLog or nsExec::ExecToStack

1. If it's a GUI program and you want the installer to wait until execution is complete, you probably want ExecWait. If you want install to continue in the background, use Exec.
2. If it's a command line program and you'd like the user to see the output, you could also use ExecWait or Exec.
3. If it's command line program and you want to hide the window, and have the install continue while it's working, and you don't care about the exit value, then you could use ExecShell with SW_HIDE.
4. If it's a command line program and you do care about the exit value, you'll need to wait until execution completes, so you'd use ExecWait or nsExec::Exec (depending on whether you want the output to be shown). Note that nsExec has a nice timeout feature just in case your program hangs.
5. If it's a command line window and you want to capture the output without making it visible to the user, you'd use nsExec::ExecToLog if the output might be fairly long (greater than 1024 characters for the default NSIS build), or you could use nsExec::ExecToStack if you're sure it's shorter than that.
Nutzzz is offline   Reply With Quote
Old 8th April 2020, 22:02   #3
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,275
You need to locate javaw.exe and then call Exec. You can find links on how to do that in your other question here.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
java

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump