Package io.vertx.launcher.application

## Class VertxApplication

- java.lang.Object
- - io.vertx.launcher.application.VertxApplication

-     public class VertxApplication
      extends Object

  A `main()` class that can be used to create the Vert.x instance and deploy a verticle.

  It can be used, for example, as the main class of an executable uber-jar, so that you can run verticles directly with: `java -jar myapp.jar`.

- - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `` | `VertxApplication​(String[] args)` | Create a new instance with the given program arguments and default behavior (print usage and exit on failure).
    `` | `VertxApplication​(String[] args, VertxApplicationHooks hooks)` | Like `VertxApplication(String[])`, with the provided `hooks`.
    `protected` | `VertxApplication​(String[] args, VertxApplicationHooks hooks, boolean printUsageOnFailure, boolean exitOnFailure)` | May be invoked by subclasses to customize behavior.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `launch()` | Launches the Vert.x application.
    `static void` | `main​(String[] args)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### VertxApplication

          public VertxApplication​(String[] args)

      Create a new instance with the given program arguments and default behavior (print usage and exit on failure).

      Subclasses may implement `VertxApplicationHooks`. In this case, this object's hook methods will be invoked at different stages of the launch process.

      Parameters:
        `args` - the program arguments

    - #### VertxApplication

          public VertxApplication​(String[] args,
                                  VertxApplicationHooks hooks)

      Like `VertxApplication(String[])`, with the provided `hooks`.
      Parameters:
        `args` - the program arguments
        `hooks` - an instance of `VertxApplicationHooks` to be invoked at different stages of the launch process

    - #### VertxApplication

          protected VertxApplication​(String[] args,
                                     VertxApplicationHooks hooks,
                                     boolean printUsageOnFailure,
                                     boolean exitOnFailure)

      May be invoked by subclasses to customize behavior.

      When the `hooks` parameter is `null`, the application instance will be used if it implements `VertxApplicationHooks`.

      Parameters:
        `args` - the program arguments
        `hooks` - an instance of `VertxApplicationHooks` to be invoked at different stages of the launch process (maybe null)
        `printUsageOnFailure` - whether usage should be printed to `System.out` if the application failed to start
        `exitOnFailure` - whether the JVM should be terminated with a specific `exitCode` if the application failed to start

  - ### Method Detail

    - #### main

          public static void main​(String[] args)

    - #### launch

          public int launch()

      Launches the Vert.x application.
      Returns:
        an exit code, `0` means the verticle has been deployed successfully