简体   繁体   中英

Use Ant to launch Java program with cmd.exe “start” command

<exec dir="${basedir}" executable="cmd.exe">
   <arg line="start cmd /c java -jar ${jar.file} "/>
</exec>

In Eclipse this does not work, I would like to open my app. The reason is io.Console because this I can't execute the app in Eclipse.

cmd appears in two places: In the executable attribute and in the <arg> . It should only appear in the executable attribute.

Further, the /c option of cmd.exe should appear before the start command, not after.

Try the following:

<exec executable="cmd.exe" failonerror="true">
    <arg value="/c"/>
    <arg value="start"/>
    <arg value="java"/>
    <arg value="-jar"/>
    <arg value="${jar.file}"/>
</exec>

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