@Incubating public class JavaShell extends Object
A shell for compiling or running pure Java code
Constructor and description |
---|
JavaShell() Initializes a newly created JavaShell object |
JavaShell(ClassLoader parentClassLoader) Initializes a newly created JavaShell object |
Type Params | Return Type | Name and description |
---|---|---|
|
public Class<?> |
compile(String className, Iterable<String> options, String src) Compile and return the main class |
|
public Class<?> |
compile(String className, String src) Compile and return the main class |
|
public Map<String, Class<?>> |
compileAll(String className, Iterable<String> options, String src) Compile and return all classes |
|
public Map<String, Class<?>> |
compileAll(String className, String src) Compile and return all classes |
|
public JavaShell.JavaShellClassLoader |
getClassLoader() When and only when compile(String, String) or compileAll(String, String) is invoked, returned class loader will reference the compiled classes. |
|
public void |
run(String className, Iterable<String> options, String src, String args) Run main method |
|
public void |
run(String className, String src, String args) Run main method |
Initializes a newly created JavaShell
object
Initializes a newly created JavaShell
object
parentClassLoader
- the parent class loader for delegationCompile and return the main class
className
- the main class nameoptions
- compiler optionssrc
- the source codeCompile and return the main class
className
- the main class namesrc
- the source codeCompile and return all classes
className
- the main class nameoptions
- compiler optionssrc
- the source codeCompile and return all classes
className
- the main class namesrc
- the source codeWhen and only when compile(String, String) or compileAll(String, String) is invoked, returned class loader will reference the compiled classes.
Run main method
className
- the main class nameoptions
- compiler optionssrc
- the source codeargs
- arguments for main methodCopyright © 2003-2022 The Apache Software Foundation. All rights reserved.