Package org.gradle.process

## Interface JavaExecSpec

- All Superinterfaces:
    `BaseExecSpec`, `JavaForkOptions`, `ProcessForkOptions`
  All Known Implementing Classes:
    `JavaExec`

      public interface JavaExecSpec
      extends JavaForkOptions, BaseExecSpec

  Specifies the options for executing a Java application.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `JavaExecSpec` | `args​(java.lang.Iterable<?> args)` | Adds args for the main class to be executed.
    `JavaExecSpec` | `args​(java.lang.Object... args)` | Adds args for the main class to be executed.
    `JavaExecSpec` | `classpath​(java.lang.Object... paths)` | Adds elements to the classpath for executing the main class.
    `java.util.List<java.lang.String>` | `getArgs()` | Returns the arguments passed to the main class to be executed.
    `java.util.List<CommandLineArgumentProvider>` | `getArgumentProviders()` | Argument providers for the application.
    `FileCollection` | `getClasspath()` | Returns the classpath for executing the main class.
    `java.lang.String` | `getMain()` | Deprecated. Use `getMainClass()` instead.
    `Property<java.lang.String>` | `getMainClass()` | The fully qualified name of the Main class to be executed.
    `Property<java.lang.String>` | `getMainModule()` | The name of the main module to be executed if the application should run as a Java module.
    `ModularitySpec` | `getModularity()` | Returns the module path handling for executing the main class.
    `JavaExecSpec` | `setArgs​(java.lang.Iterable<?> args)` | Sets the args for the main class to be executed.
    `JavaExecSpec` | `setArgs​(java.util.List<java.lang.String> args)` | Sets the args for the main class to be executed.
    `JavaExecSpec` | `setClasspath​(FileCollection classpath)` | Sets the classpath for executing the main class.
    `JavaExecSpec` | `setMain​(java.lang.String main)` | Deprecated. Use `getMainClass()`.set(main) instead.

    - ### Methods inherited from interface org.gradle.process.BaseExecSpec

      `getCommandLine, getErrorOutput, getStandardInput, getStandardOutput, isIgnoreExitValue, setErrorOutput, setIgnoreExitValue, setStandardInput, setStandardOutput`

    - ### Methods inherited from interface org.gradle.process.JavaForkOptions

      `bootstrapClasspath, copyTo, debugOptions, getAllJvmArgs, getBootstrapClasspath, getDebug, getDebugOptions, getDefaultCharacterEncoding, getEnableAssertions, getJvmArgs, getJvmArgumentProviders, getMaxHeapSize, getMinHeapSize, getSystemProperties, jvmArgs, jvmArgs, setAllJvmArgs, setAllJvmArgs, setBootstrapClasspath, setDebug, setDefaultCharacterEncoding, setEnableAssertions, setJvmArgs, setJvmArgs, setMaxHeapSize, setMinHeapSize, setSystemProperties, systemProperties, systemProperty`

    - ### Methods inherited from interface org.gradle.process.ProcessForkOptions

      `copyTo, environment, environment, executable, getEnvironment, getExecutable, getWorkingDir, setEnvironment, setExecutable, setExecutable, setWorkingDir, setWorkingDir, workingDir`

- - ### Method Detail

    - #### getMainModule

          @Optional
          @Input
          Property<java.lang.String> getMainModule()

      The name of the main module to be executed if the application should run as a Java module.
      Since:
        6.4

    - #### getMainClass

          @Optional
          @Input
          Property<java.lang.String> getMainClass()

      The fully qualified name of the Main class to be executed.

      This does not need to be set if using an Executable Jar with a `Main-Class` attribute.

      Use this property instead of `getMain()` and `setMain(String)`.

      Since:
        6.4

    - #### getMain

          @Deprecated
          @Nullable
          @Optional
          @ReplacedBy("mainClass")
          java.lang.String getMain()

      Deprecated.
      Use `getMainClass()` instead. This method will be removed in Gradle 8.0.
      Returns the fully qualified name of the Main class to be executed.

      This does not need to be set if using an Executable Jar with a `Main-Class` attribute.

    - #### setMain

          @Deprecated
          @ReplacedBy("mainClass")
          JavaExecSpec setMain​(@Nullable
                               java.lang.String main)

      Deprecated.
      Use `getMainClass()`.set(main) instead. This method will be removed in Gradle 8.0.
      Sets the fully qualified name of the main class to be executed.
      Parameters:
        `main` - the fully qualified name of the main class to be executed.
      Returns:
        this

    - #### getArgs

          @Nullable
          @Optional
          @Input
          java.util.List<java.lang.String> getArgs()

      Returns the arguments passed to the main class to be executed.

    - #### args

          JavaExecSpec args​(java.lang.Object... args)

      Adds args for the main class to be executed.
      Parameters:
        `args` - Args for the main class.
      Returns:
        this

    - #### args

          JavaExecSpec args​(java.lang.Iterable<?> args)

      Adds args for the main class to be executed.
      Parameters:
        `args` - Args for the main class.
      Returns:
        this

    - #### setArgs

          JavaExecSpec setArgs​(@Nullable
                               java.util.List<java.lang.String> args)

      Sets the args for the main class to be executed.
      Parameters:
        `args` - Args for the main class.
      Returns:
        this
      Since:
        4.0

    - #### setArgs

          JavaExecSpec setArgs​(@Nullable
                               java.lang.Iterable<?> args)

      Sets the args for the main class to be executed.
      Parameters:
        `args` - Args for the main class.
      Returns:
        this

    - #### getArgumentProviders

          java.util.List<CommandLineArgumentProvider> getArgumentProviders()

      Argument providers for the application.
      Since:
        4.6

    - #### classpath

          JavaExecSpec classpath​(java.lang.Object... paths)

      Adds elements to the classpath for executing the main class.
      Parameters:
        `paths` - classpath elements
      Returns:
        this

    - #### getClasspath

          @Classpath
          FileCollection getClasspath()

      Returns the classpath for executing the main class.

    - #### setClasspath

          JavaExecSpec setClasspath​(FileCollection classpath)

      Sets the classpath for executing the main class.
      Parameters:
        `classpath` - the classpath
      Returns:
        this

    - #### getModularity

          ModularitySpec getModularity()

      Returns the module path handling for executing the main class.
      Since:
        6.4