Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8100715

Support for command line arguments in Application

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: fx2.0
    • Fix Version/s: None
    • Component/s: javafx
    • Environment:

      Windows 7 64bit, Java 7 b144 32bit, JavaFX 2.0 b30

      Description

      Through Application.launch() allows to pass command line arguments to the method, BUT there is no direct way to have access to those arguments from within Application.launch().

      Suggestions :

      - Either add accessor methods in Application to get access to a String[] or UnmodifiableList<String> or Set<String> that contains those arguments.

      - or make the Application class try various constructor for the initialization of the child class before defaulting to the constructor without argument.

      ie :

      public class Main extends Application {
         public Main (String[] args) {...}

       /**
           * @param args the command line arguments
           */
          public static void main(String[] args) {
              Application.launch(Main.class, args);
          }
      }

      or

      public class Main extends Application {
         public Main (String... args) {...}

       /**
           * @param args the command line arguments
           */
          public static void main(String[] args) {
              Application.launch(Main.class, args);
          }
      }

      or

      public class Main extends Application {
         public Main (List<String> args) {...}

       /**
           * @param args the command line arguments
           */
          public static void main(String[] args) {
              Application.launch(Main.class, args);
          }
      }

      or

      public class Main extends Application {
         public Main (Set<String> args) {...}

       /**
           * @param args the command line arguments
           */
          public static void main(String[] args) {
              Application.launch(Main.class, args);
          }
      }


      Currently the only way to have access to the command line arguments is to store them in a static member of the class.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              kcr Kevin Rushforth
              Reporter:
              fbouyajfx Fabrice Bouyé (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported: