eclipse - Giving input to Java through a batch file -
i developing application in users give input in batch file , batch file input given input eclipse , oy run java program(logic) , give output either through batch file or excel.
in eclipse can set arguments using run > run configurations > arguments
running jar file directly works simple: java -jar somefile.jar port ip whatever else
those arguments passed main()
method string[]
, if want numbers have convert them.
public static void main(string[] args) { system.out.println(args[0]); // port system.out.println(args[1]); // ip system.out.println(args[2]); // whatever system.out.println(args[3]); // else }
Comments
Post a Comment