I have 2 jar files at different locations. I need to run both these jar files from a single command prompt window.
I referred to many SO links and google links and created this batch job.
START SET JPOS_DIR=D:\Installable\JPOS\Iso8583jPOSJavaAgent-0.0.11
cd /D %JPOS_DIR%
"C:\Program Files\Java\jdk1.7.0_75\bin\java" -cp Iso8583jPOSJavaAgent-0.0.11.jar com.hp.sv.iso8583.jpos.ISOForwarderMain
START SET JPOS_DIR=D:\Installable\JPOS_Instance-2\Iso8583jPOSJavaAgent-0.0.11
cd /D %JPOS_DIR%
start "C:\Program Files\Java\jdk1.7.0_75\bin\java" -cp Iso8583jPOSJavaAgent-0.0.11.jar com.hp.sv.iso8583.jpos.ISOForwarderMain
But i am getting the below error message
"Windows cannot find -cp. make sure you type the name correctly and try again."
Can someone tell me what I am missing here ?
The syntax for the start command is as follows,
START "title" [/D path] [options] "command" [parameters]
so in the command,
start "C:\Program Files\Java\jdk1.7.0_75\bin\java" -cp Iso8583jPOSJavaAgent-0.0.11.jar com.hp.sv.iso8583.jpos.ISOForwarderMain
it considers "C:\\Program Files\\Java\\jdk1.7.0_75\\bin\\java" as title and -cp as the command to run, thats why you get the error.
Try using the following command,
start "title" "C:\Program Files\Java\jdk1.7.0_75\bin\java" -cp Iso8583jPOSJavaAgent-0.0.11.jar com.hp.sv.iso8583.jpos.ISOForwarderMain
Alternatively, you can run without any quotes where we don't need to pass the title,
start java -cp Iso8583jPOSJavaAgent-0.0.11.jar com.hp.sv.iso8583.jpos.ISOForwarderMain
set Java in PATH before executing this command. Hope this helps.
-cp
is not valid windows cdm
command... I think you missed start
at first execution:
"C:\Program Files\Java\jdk1.7.0_75\bin\java" -cp Iso8583jPOSJavaAgent-0.0.11.jar com.hp.sv.iso8583.jpos.ISOForwarderMain
must be
start "C:\Program Files\Java\jdk1.7.0_75\bin\java" -cp Iso8583jPOSJavaAgent-0.0.11.jar com.hp.sv.iso8583.jpos.ISOForwarderMain
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.