Help option in a JAR FILE
-
i have created a jar to copy two files using Variable argument whichis working correctly e.g java jar filecopy.jar file1 file2 i want to provide a -help option in this which will be like below and user must aware what he has to pass in arguments e.g java jar filecopy.jar -help how do i do this not getting any idea :new to java,urgent help required !!!!
-
i have created a jar to copy two files using Variable argument whichis working correctly e.g java jar filecopy.jar file1 file2 i want to provide a -help option in this which will be like below and user must aware what he has to pass in arguments e.g java jar filecopy.jar -help how do i do this not getting any idea :new to java,urgent help required !!!!
-
You just add the code to check for "-help" as a filename, and branch to the code which displays the help.
did you men alike this ...
public static void main(String[] args) {
String filename1 = args[0];
String filename2 = args[1];if ((!(filename1.length() > 0)) || (!(filename2.length() > 0))) { System.out .println("please provide the foldername and string to be replaced "); return; } if(args\[0\] == "help" ) { System.out .println("please run the utility as filecopy file1 file2"); }
can you edit it if wrong
-
did you men alike this ...
public static void main(String[] args) {
String filename1 = args[0];
String filename2 = args[1];if ((!(filename1.length() > 0)) || (!(filename2.length() > 0))) { System.out .println("please provide the foldername and string to be replaced "); return; } if(args\[0\] == "help" ) { System.out .println("please run the utility as filecopy file1 file2"); }
can you edit it if wrong