I use the class javax.tools.JavaCompiler (jdk6) to compile a source file, but the source file depends on some jar file. How to set the classpath of the javax.tools.JavaCompiler?
...
I'm trying to compile many files using the Compiler API.
Say I have a directory structure
.../program
+/org
+/foo
|+ Main.java
+/bar
+ Tools.java
Is there any way to discover all the Java files and make it compiler everything without resorting to recursing into all the directories and finding all the *.java file...
hi, i want to use JavaCompiler to dynamic create some classes.
i find the source code of javax.tools package, but there is no implementation, some posts on internet says it depends on tools.jar, i am not sure tools.jar associates with JRE.
so can i run the program in a JRE environment without JDK installed?
another question, what is t...
So I recently learned of the new JavaCompiler API available in JDK 1.6. This makes it very simple to compile a String to a .class file directly from running code:
String className = "Foo";
String sourceCode = "...";
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
List<JavaSourceFromString> unitsToCompile = new ArrayList...
Hi,
Is there any way to run program compiled by JavaCompiler? [javax.tools.JavaCompiler]
My code:
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>();
CompilationTask task = compiler.getTask(null, null, diagnostics, null, n...