My java program works fine with cmd. It takes 5arguments and also has external library. So I am running it from cmd like
java -cp .;jxl.jar MyProgram d: abc 1 d://sv 0
I would like to develop .cmd file which will run this program and also all these arguments should be passed to that cmd file and this cmd file will give it to the jar.
So what I want is
runner.cmd d: abc 1 d://sv 0
and all these argument should get passed to java runner command.
Till now what I have done is that, I have created a cmd file with
@echo off
java -cp ,;jxl.jar MyProgram d: abc 1 d://sv 0
It works fine. Now I dont know how to pass parameters from cmd to jar.
Write your runner.cmd as
@echo off
java -cp .;jxl.jar MyProgram %*
%* is a wildcard for all parameters passed to the batch file.
You can reference them using %1, %2 and so on. Put this in your file:
java -cp ,;jxl.jar MyProgram %1 %2 %3 %4 %5
Then you can call it using
runner.cmd d: abc 1 d://sv 0
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With