Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. Help option in a JAR FILE

Help option in a JAR FILE

Scheduled Pinned Locked Moved Java
javahelpquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    ramina sen
    wrote on last edited by
    #1

    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 !!!!

    L 1 Reply Last reply
    0
    • R ramina sen

      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 !!!!

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You just add the code to check for "-help" as a filename, and branch to the code which displays the help.

      R 1 Reply Last reply
      0
      • L Lost User

        You just add the code to check for "-help" as a filename, and branch to the code which displays the help.

        R Offline
        R Offline
        ramina sen
        wrote on last edited by
        #3

        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

        L 1 Reply Last reply
        0
        • R ramina sen

          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

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Something like that, but you can easily test it.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups