Warning: Cannot use jsr199 Javac from jrt-fs.jar"
Jonathan Gibbons
jonathan.gibbons at oracle.com
Thu Oct 8 01:39:07 UTC 2015
Yes, the message says that "JDevJavaCompiler ... cannot access ...
com.sun.tools.javac.api.JavacTool"
and indeed, com.sun.tools.javac.api is not a supported public API.
Here's the standard comment from the head of the file:
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own
* risk. This code and its internal interfaces are subject to change
* or deletion without notice.</b></p>
If you want to break through the module boundaries, you'll have to use
-XaddExports.
-- Jon
On 10/07/2015 06:12 PM, Mandy Chung wrote:
> ToolProvider.getSystemJavaCompiler() will return the system compiler (javac) from the image. Is there any reason why you can’t use that?
>
> It seems to me that the exception is thrown because com.sun.tools.javac.api.JavacTool member is called.
>
> Mandy
>
>> On Oct 7, 2015, at 6:01 PM, Keimpe Bronkhorst <keimpe.bronkhorst at oracle.com> wrote:
>>
>> The underlying exception I get is:
>> "Class oracle.jdevimpl.javacompiler.JDevJavaCompiler can not access a member of class com.sun.tools.javac.api.JavacTool (module jdk.compiler) with modifiers "public static", module jdk.compiler does not export com.sun.tools.javac.api to <unnamed module @1cfeea20>"
>>
>> Will there be a "public API" way to run JSR199 of any JDK9 installation?
>>
>> Keimpe Bronkhorst
>> JDeveloper
>>
>> On 10/7/2015 6:54 PM, Keimpe Bronkhorst wrote:
>>> It is possible in JDK8 and before to run JSR199 compilations using a class loader that loads from tools.jar. I can't do something similar in JDK9 using a new jigsaw build, trying to load from jrt-fs.jar. I get this: Warning: Cannot use jsr199 Javac from jrt-fs.jar".
>>>
>>> Does this mean you can only use the JSR199 as provided by ToolProvider.getSystemJavaCompiler() of the current process in JDK9?
>>>
>>> Keimpe Bronkhorst
>>> JDeveloper
More information about the jigsaw-dev
mailing list