Class LaunchMultiFileSourceProgramsExamples

java.lang.Object
net.jrodolfo.java_evolution.java22.launch_multi_file_source_programs.LaunchMultiFileSourceProgramsExamples

public class LaunchMultiFileSourceProgramsExamples extends Object
Demonstrates Java 22 multi-file source-program launching.
  • Constructor Details

    • LaunchMultiFileSourceProgramsExamples

      public LaunchMultiFileSourceProgramsExamples()
  • Method Details

    • createGreetingSourceTree

      public void createGreetingSourceTree(Path directory) throws IOException
      Creates a small source tree where Main.java uses helper source files.
      Parameters:
      directory - directory where source files should be created
      Throws:
      IOException - when the source tree cannot be written
    • createBrokenSourceTree

      public void createBrokenSourceTree(Path directory) throws IOException
      Creates a source tree that should fail because Main.java references a missing helper type.
      Parameters:
      directory - directory where source files should be created
      Throws:
      IOException - when the source tree cannot be written
    • launchMain

      public LaunchMultiFileSourceProgramsExamples.LaunchResult launchMain(Path sourceDirectory, String... arguments) throws IOException, InterruptedException
      Runs java Main.java in the supplied source directory.
      Parameters:
      sourceDirectory - directory containing Main.java
      arguments - application arguments passed after Main.java
      Returns:
      child-process result
      Throws:
      IOException - when the child JVM cannot be started
      InterruptedException - when interrupted while waiting for the child JVM