jsr199

How to set classpath when I use javax.tools.JavaCompiler compile the source?

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? ...

Compiling a set of Java files inside a directory tree with the JSR 199 Compiler API

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...

is javax.tools depends on JDK?

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...

JavaCompiler from JDK 1.6: how to write class bytes directly to byte[] array?

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...

how to run code compiled by JavaCompiler ?

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...