public class Compiler extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Compiler.Result |
Constructor and Description |
---|
Compiler() |
Modifier and Type | Method and Description |
---|---|
static String |
appendToPath(String path,
String append) |
static Compiler.Result |
compile(String path,
String classPath,
String rootDir,
String outPath,
String[] extraArgs)
Borrowing very heavily from Johannes Schindelin's Refresh_Javas.compile method.
|
static String |
discoverJars(String path)
Copied from Johannes Schindelin's Refresh_Javas.discoverJars method.
|
static String |
getClasspath()
Modified from Johannes Schindelin's Refresh_Javas.getPluginsClassPath method.
|
static String |
getPackageName(String path)
Copied from Johannes Schindelin's Refresh_Javas.getPackageName method.
|
static File |
getSourceRootDirectory(String path)
Copied from Johannes Schindelin's Refresh_Javas.getSourceRootDirectory method.
|
protected static String[] |
unshift(String[] list,
String[] add)
Copied from Johannes Schindelin's Refresh_Javas.unshift method.
|
public static String getClasspath()
public static String discoverJars(String path) throws IOException
IOException
public static File getSourceRootDirectory(String path) throws IOException
IOException
public static String getPackageName(String path) throws IOException
IOException
public static Compiler.Result compile(String path, String classPath, String rootDir, String outPath, String[] extraArgs) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException
path
- The file path to the .java file to compile.classPath
- The java classpath, which for Fiji includes all .jar files under /jars and /plugins
and can be obtained from getClasspath()
.rootDir
- Optional (can be null). The top-level root directory from which the java file is to be compiled.outPath
- Optional (can be null), the target file path for the .class file(s). Will use the same folder as the .java file when null.extraArgs
- Optional (can be null). Additional arguments for the javac compiler.Compiler.Result
object indicating success or not, and if so an error message.ClassNotFoundException
NoSuchMethodException
IllegalAccessException
InvocationTargetException
Copyright © 2015–2021 Fiji. All rights reserved.