简体   繁体   中英

Passing values from Java to nsis script

I have a java code, where I give some variable dynamically. I need to pass that value to the nsis script. For example I will get a value of the variable age at runtime, and pass it to the var of the nsis script. Is it possible. Any suggestions...

The way I pass data to the NSIS script is with ant. When you build your installer you can place tokens in the NSI file and replace them. example using @product.name@ in the NSI file.:

  <replace file="${release.dir}/installer.nsi" token="@product.name@" value="${product.name}"/>

You can read environment variables in NSIS files like this:

$%envVarName%

In addition, the ant task allows to set symbols directly:

<nsis script="myproject.nsi" verbosity="4" out="build.log" noconfig="yes">
    <define name="VERSION" value="2.1"/>
</nsis>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM