Reputation: 1997
UPDATE: I eventually discovered that the trouble described below was just the initial presenting problem. The actual issue is that after updating from Java 8 to Java 10 (and 11) Eclipse was unable to compile my project properly. The JDK library and other settings were configured properly, and I was getting nearly 1,000 compile errors.
There is no reason to read any further
I upgraded a swing app from JDK 8 to JDK 10 (Oracle Java on a Mac), and eclipse complains that javax.accessibility.Accessible
is missing, and required by one of my classes. I understand what that error means, but I can't figure out why eclipse can't find that package. I've searched the net for over an hour, and I can't a hint of anyone having this problem. It seems I should just be able to access that package from within the JDK, but I'm obviously missing something.
EDIT2:
I turned off the flag to abort the build when it has an error, and I see now there are hundreds of errors. It's hard to say which ones are primary, but a common occurrence is class java.awt.<SomeClass> is not accessible
. This seems to occur for every awt class. My code is not organized as modules, and I see java.desktop
as implicitly available on the Modulepath
. Also, the ant build of this code works fine.
EDIT:
As suggested in the comments, this is likely an IDE misconfiguration, but I don't know what I can fix. I've been away from Java for a few years, and while I've kept up enough to know that the JDK was re-organized with JDK 9, and modules were introduced, I don't know if there's something I'm supposed to do explicitly to make the javax.accessibility
package available on the classpath. I just added a JRE System library to the build path in the project the way I've always done with Java projects in Eclipse.
In the build path config UI, I see the JRE System Library (bound to JDK 10) as the only entry under Modulepath
. Under the JRE System Library, I see a number of modules, and above them is an entry Is Module
which I can edit. It shows me available modules on the left, and explicitly and implicitly included modules in two tree tables on the right. None of these include javax.accessibility
, but jdk.accessibility
is listed as explicitly included. None of the available modules on the left seem to have any relationship to accessibility. So I'm at a loss as to what I can do further to include that missing package. Some swing classes are depending on it, so it seems it should just be there by default.
Upvotes: 0
Views: 1578
Reputation: 1997
It turns out that Eclipse does not support Java 10+ except in specific (older) releases. I had been using the latest release (4.9.0), and that was presenting extensive compilation problems (nearly 1,000 errors) using Java 10 and Java 11 JDKs. (The javax.accessibility
issue described in my question was only the first presenting system.)
I installed Eclipse Oxygen.3a (4.7.3a) and all the compilation problems using JDKs 10 and 11 disappeared. There was an issue at first, which was easily solved. After importing an existing Java project into the workspace, there were even more compile errors than before. This was because the JRE System Library setting in the .project file was apparently incompatible. The JRE appeared as an unbound library under Classpath
. I just removed that and added the JRE System Library under Modulepath
, and everything compiled with no errors.
I saw a post from several months ago that Eclipse Photon support for Java 10 was in the works, but I didn't try it.
Upvotes: 1