What happened to javax.compiler (JSR-199)?

Hi,

A friend of mine was wanting to dynamically compile some Java code. I remembered that Java 6 was supposed to include JSR-199 (the standard interface onto the javac APIs in tools.jar, implemented via "javax.compiler") and have seen examples of its use with the Early Access builds of Java 6. So I thought I'd give it a try...

Started a new IDEA 7 project, added "import javax.compiler.*;" to a new class, and IDEA said "cannot resolve symbol 'compiler'". So I had a look inside rt.jar and tools.jar, and effectively, I couldn't find it... Then went onto http://java.sun.com/javase/6/docs/api/index.html and couldn't find the Javadocs for it... so went to http://jcp.org/aboutJava/communityprocess/final/jsr199/index.html and the link to download the reference implementation points to the Java SE 6 download, and mentions that it's included in Java 6. So it seems it should be bundled, but has been forgotten!!!

The page http://java.sun.com/javase/6/webnotes/features.html lists the bugs/RFEs fixed in Java 6 (search for "JSR 199: Java compiler API" in that page), and points to http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4164450 as being fixed in Java 6.

I'm using Java SE 6 (Update 3), under Windows XP SP2. Have they really forgotten it, or have I just missed something?

Thanks,
Chris

2 comments

The API was generalized and moved to a different package.
See
http://java.sun.com/javase/6/docs/api/javax/tools/package-summary.html

Christopher Brown wrote:

Hi,

A friend of mine was wanting to dynamically compile some Java code. I remembered that Java 6 was supposed to include JSR-199 (the standard interface onto the javac APIs in tools.jar, implemented via "javax.compiler") and have seen examples of its use with the Early Access builds of Java 6. So I thought I'd give it a try...

Started a new IDEA 7 project, added "import javax.compiler.*;" to a new class, and IDEA said "cannot resolve symbol 'compiler'". So I had a look inside rt.jar and tools.jar, and effectively, I couldn't find it... Then went onto http://java.sun.com/javase/6/docs/api/index.html and couldn't find the Javadocs for it... so went to http://jcp.org/aboutJava/communityprocess/final/jsr199/index.html and the link to download the reference implementation points to the Java SE 6 download, and mentions that it's included in Java 6. So it seems it should be bundled, but has been forgotten!!!

The page http://java.sun.com/javase/6/webnotes/features.html lists the bugs/RFEs fixed in Java 6 (search for "JSR 199: Java compiler API" in that page), and points to http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4164450 as being fixed in Java 6.

I'm using Java SE 6 (Update 3), under Windows XP SP2. Have they really forgotten it, or have I just missed something?

Thanks,
Chris

0

Thanks! I missed that one :)

I can't seem to get the "helpful answer" or "correct answer" features to work. :(

0

Please sign in to leave a comment.