简体   繁体   中英

How can i pass parametersfrom a windows batch script to java

I need to read some parameters , which are defined in a windows batch script,in my java program... How can i define parameters..? for eg I need to read a variable which is defined in the script; variable v=XYX

i tried defining like(in the script);

java  -Dvariable=XYX

but getting following exception;

Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)

where options include:
    -client       to select the "client" VM

You have to call the main method of your class first

java com.xyz.MyClass -Dvariable=XYX

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