passing parameter to a jar file which is called in a bat file?

我与影子孤独终老i 提交于 2019-12-01 21:33:25

Inside you bat file you will have java command
just use java -jar helloworld.jar firstParam secondParam and
I believe you can also use because that how we pass params to Maven and ANT etc

mybatchFile.bat -DfirstParam -DsecondParam

The parameters that you pass to your batch file can be accessed via

%1 %2 %3 ...

So if you call your batch like

C:>application.bat param1 param2 param3

then your java call inside the batch file should look like:

@echo off
java -cp app.jar com.example.Main %1 %2 %3
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!