Announcement

Collapse
No announcement yet.

How execute .jar with arguments?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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!

  • #2
    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.

    Comment


    • #3
      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

      Comment

      Working...
      X
      😀
      🥰
      🤢
      😎
      😡
      👍
      👎