# Class ModularRuntimeImage

java.lang.Object
org.apache.bcel.util.ModularRuntimeImage

All Implemented Interfaces:
  `Closeable, AutoCloseable`

public class ModularRuntimeImage extends Object implements Closeable
Wraps a Java 9 JEP 220 modular runtime image. Requires the JRT NIO file system.

Since:
  6.3

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ModularRuntimeImage()`
  Constructs a default instance.
  `ModularRuntimeImage(String javaHome)`
  Constructs an instance using the JRT file system implementation from a specific Java Home.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `FileSystem`
  `getFileSystem()`
  `List<Path>`
  `list(String dirName)`
  Lists all entries in the given directory.
  `List<Path>`
  `list(Path dirPath)`
  Lists all entries in the given directory.
  `List<Path>`
  `modules()`
  Lists all modules.
  `List<Path>`
  `packages()`
  Lists all packages.

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### ModularRuntimeImage

    public ModularRuntimeImage()
    Constructs a default instance.

  - ### ModularRuntimeImage

    public ModularRuntimeImage(String javaHome) throws IOException
    Constructs an instance using the JRT file system implementation from a specific Java Home.
    Parameters:
      `javaHome` - Path to a Java 9 or greater home.
    Throws:
      `IOException` - an I/O error occurs accessing the file system

- ## Method Details

  - ### close

    public void close() throws IOException
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `Closeable`
    Throws:
      `IOException`

  - ### getFileSystem

    public FileSystem getFileSystem()

  - ### list

    public List<Path> list(Path dirPath) throws IOException
    Lists all entries in the given directory.
    Parameters:
      `dirPath` - directory path.
    Returns:
      a list of dir entries if an I/O error occurs
    Throws:
      `IOException` - an I/O error occurs accessing the file system

  - ### list

    public List<Path> list(String dirName) throws IOException
    Lists all entries in the given directory.
    Parameters:
      `dirName` - directory path.
    Returns:
      a list of dir entries if an I/O error occurs
    Throws:
      `IOException` - an I/O error occurs accessing the file system

  - ### modules

    public List<Path> modules() throws IOException
    Lists all modules.
    Returns:
      a list of modules
    Throws:
      `IOException` - an I/O error occurs accessing the file system

  - ### packages

    public List<Path> packages() throws IOException
    Lists all packages.
    Returns:
      a list of modules
    Throws:
      `IOException` - an I/O error occurs accessing the file system