I've tried to compile, at runtime, a .java file from code and everything works fine on eclipse. But when I've tried to export the project, making a runnable jar file and then execute the jar... well, nothing happens. Why it doesn't work from the runnable jar file?
Here's what I see on the java console after the execution of the jar:
30/10/15 13:47:19,597 iconservicesagent[265]:
Failed to get the real path for: /var/folders/xd/jg7p911x3bd76jyy071hl6lw0000gn/
C/com.apple.iconservices
And here the java code that I use to compile a source file:
try {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>();
StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnostics, null, null);
Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjectsFromStrings(Arrays.asList("generated/Crilin.java"));
JavaCompiler.CompilationTask task = compiler.getTask(null, fileManager, diagnostics, null,
null, compilationUnits);
task.call();
fileManager.close();
} catch (Exception e) {
e.printStackTrace();
}