кто-то я использую это:
org.apache.commons.jci.compilers.JavacJavaCompiler
У меня есть класс jci:
public void compile() {
sourceDir = new File("java");
sources = new String[] { "test/HelloWorld.java" };
target = new File("result");
JavacJavaCompilerSettings settings = new JavacJavaCompilerSettings();
JavacJavaCompiler javacJavaCompiler = new JavacJavaCompiler(settings);
System.out.println("compile -> " + sources);
System.out.println("compile -> " + sourceDir);
System.out.println("compile -> " + target);
CompilationResult result = javacJavaCompiler.compile(sources,
new FileResourceReader(sourceDir),
new FileResourceStore(target));
for (CompilationProblem cp : result.getErrors()) {
System.out.println("compile -> " + cp.getStartLine());
System.out.println("compile -> " + cp.getMessage());
}
}
и мой вывод:
compile -> 0
compile -> Failure executing javac, but could not parse the error: javac: file not found: test/HelloWorld.java
Usage: javac <options> <source files>
use -help for a list of possible options
какая-то идея, ты.