Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » JDK12 - "com.sun.tools" not accessible
JDK12 - "com.sun.tools" not accessible [message #1818211] Tue, 10 December 2019 09:48 Go to next message
Albert Palio is currently offline Albert PalioFriend
Messages: 1
Registered: December 2019
Junior Member
I'm trying to import in Eclipse (2019-09 R (4.13.0)) a Maven project which uses the JDK 12 and makes use of classes from the com.sun.tools package.
Everything compiles fine, except for the classes from that package, which are found but not accessible (the compiler raises the error "The package com.sun.tools.javac.api is not accessible").
How to fix this?

Thanks
Re: JDK12 - "com.sun.tools" not accessible [message #1818242 is a reply to message #1818211] Tue, 10 December 2019 20:55 Go to previous message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
Oracle really doesn't want you to access classes in com.sun.tools.javac.api, the corresponding module-info for jdk.compiler declares:
    exports com.sun.tools.javac.api to
        jdk.javadoc,
        jdk.jshell;


Ergo, the package is accessible only to those two modules.

If you must break these rule (and take all responsibility on yourself), see:
- https://help.eclipse.org/2019-06/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fref-properties-build-path.htm&anchor=module-dependencies
- https://www.youtube.com/watch?v=UUQoQtKgaWc&list=PLy7t4z5SYNaT_yo5Dhajb9i-Pf0LbQ3z8&index=24

(look out for the parts about exports).
Stephan
Previous Topic:Cant start javascpirt project
Next Topic:openxmlformats schemas problem with indirect refrerence
Goto Forum:
  


Current Time: Thu Dec 05 13:42:40 GMT 2024

Powered by FUDForum. Page generated in 0.02975 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top