Use argument from the console JAVA -
i want use arguments console in ubuntu
./mytool -ip 1.2.3.4
how can tack\use 1.2.3.4 in code that
public static void main(string[] argv) throws exception { for(int i=0;i<argv.length;i++) { if (argv[i].equals("-ip")) { ping(80,"the ip want(1.2.3.4)") } } }
for more generic approach parsing cmdline arguments recommend using 1 of existing frameworks - heavy lifting you.
take @ jopt simple - 1 used eg. openjdk.
Comments
Post a Comment