简体   繁体   中英

How to pass program arguments to java packager?

I'm trying to create a native executable out of a .jar file I have locally. All looks fine except that I'm currently executing the jar file with an argument ( abc ):

java -Dappbase=http://localhost:80/getdown/xyz/ -jar getdown-1.7.1.jar abc

This is what I'm using to generate my native image:

javapackager \
  -deploy -BjvmProperties=appbase=http://localhost:80/getdown/xyz/ \
  -native \
  -outdir result \
  -outfile sample \
  -srcfiles getdown-1.7.1.jar \
  -appclass com.threerings.getdown.launcher.GetdownApp

How to signal javapackager that I'd like it to run com.threerings.getdown.launcher.GetdownApp with abc as an argument?

Thanks

This may help you.

Sources : https://docs.oracle.com/javafx/2/deployment/javafx_ant_task_reference002.htm

https://docs.oracle.com/javafx/2/deployment/javafx_ant_task_reference002.htm#CACIJFHB

 <fx:application name="Sample app"
    mainClass="test.MyApplication">
  <!-- unnamed arguments -->
  <fx:argument>Something</fx:argument>
  <!-- value with spaces that are generated at build time -->
  <fx:argument>JRE version: ${java.version}</fx:argument>
  <!-- example of value using a special character -->
  <fx:argument>true &amp; false</fx:argument>
 </fx:application> 

I can't speak for Java packager, but to pass commandline arguments to Getdown you want to do something like:

java -jar getdown-1.7.1.jar appdir "" abc

think of appdir "" as boilerplate for you to pass abc :)

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