Class LaunchMultiFileSourceProgramsExamples
java.lang.Object
net.jrodolfo.java_evolution.java22.launch_multi_file_source_programs.LaunchMultiFileSourceProgramsExamples
Demonstrates Java 22 multi-file source-program launching.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordCaptures the launcher child process result. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateBrokenSourceTree(Path directory) Creates a source tree that should fail becauseMain.javareferences a missing helper type.voidcreateGreetingSourceTree(Path directory) Creates a small source tree whereMain.javauses helper source files.launchMain(Path sourceDirectory, String... arguments) Runsjava Main.javain the supplied source directory.
-
Constructor Details
-
LaunchMultiFileSourceProgramsExamples
public LaunchMultiFileSourceProgramsExamples()
-
-
Method Details
-
createGreetingSourceTree
Creates a small source tree whereMain.javauses helper source files.- Parameters:
directory- directory where source files should be created- Throws:
IOException- when the source tree cannot be written
-
createBrokenSourceTree
Creates a source tree that should fail becauseMain.javareferences 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 Runsjava Main.javain the supplied source directory.- Parameters:
sourceDirectory- directory containingMain.javaarguments- application arguments passed afterMain.java- Returns:
- child-process result
- Throws:
IOException- when the child JVM cannot be startedInterruptedException- when interrupted while waiting for the child JVM
-