I have read that Java 6 has a compiler api which allows you to compile java files from other java code. However whenever I try to import any such class (eg javax.tools.JavaCompilerTool), I get a
unable to resolve class javax.tools.JavaCompilerTool
I searched in all the jar files in the jdk1.6.0_26 installation directory and found no reference to JavaCompilerTool in any jar file in the package javax.tools.
My understanding is that this functionality is in the 1.6 JDK. I am running my application with the java.exe from the \bin directory and not the \jre\bin directory but regardless neither work.
What am I missing? How can the class not be found. Is that a compiletime or runtime error? (I don't recognize it being a compiletime one from Oracle). If runtime, how exactly are you running it? As a webapp on a servletcontainer or something? If so, are you sure the servletcontainer is using the JDK's JRE?
以上就是The Java Compiler API does not work I keep getting unable to resolve class javax.tools.JavaCompilerTool and other similar ones的详细内容，更多请关注web前端其它相关文章！