ExecutionEnv (Java SE 26 & JDK 26)
Description: declaration: module: jdk.jshell, package: jdk.jshell.spi, interface: ExecutionEnv
Keywords: jdk.jshell.spi.ExecutionEnv interface

# Interface ExecutionEnv

public interface ExecutionEnv
Functionality made available to a pluggable JShell execution engine. It is provided to the execution engine by the core JShell implementation.

This interface is designed to provide the access to core JShell functionality needed to implement ExecutionControl.

Since:
  9
See Also:
  - `ExecutionControl`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `closeDown()`
  Reports that the execution engine has shutdown.
  `default Optional<JShellConsole>`
  `console()`
  Returns the `JShellConsole` that should be used by the execution engine, or `null` if none.
  `List<String>`
  `extraRemoteVMOptions()`
  Returns the additional VM options to be used when launching the remote JVM.
  `PrintStream`
  `userErr()`
  Returns the user's error stream.
  `InputStream`
  `userIn()`
  Returns the user's input stream.
  `PrintStream`
  `userOut()`
  Returns the user's output stream.

- ## Method Details

  - ### userIn

    InputStream userIn()
    Returns the user's input stream.
    Returns:
      the user's input stream

  - ### userOut

    PrintStream userOut()
    Returns the user's output stream.
    Returns:
      the user's output stream

  - ### userErr

    PrintStream userErr()
    Returns the user's error stream.
    Returns:
      the user's error stream

  - ### extraRemoteVMOptions

    List<String> extraRemoteVMOptions()
    Returns the additional VM options to be used when launching the remote JVM. This is advice to the execution engine.

    Note: an execution engine need not launch a remote JVM.

    Returns:
      the additional options with which to launch the remote JVM

  - ### closeDown

    void closeDown()
    Reports that the execution engine has shutdown.

  - ### console

    default Optional<JShellConsole> console()
    Returns the `JShellConsole` that should be used by the execution engine, or `null` if none.

    Note: an execution engine may not support `JShellConsole`.

    Implementation Requirements:
      The default implementation of this method returns an empty `Optional`.
    Returns:
      returns console, or an empty `Optional` if none, never `null`
    Since:
      21