Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » All Java 8 classes opened in 2021-13 fail with Java 9 related error, but perhaps caused by Java 16
All Java 8 classes opened in 2021-13 fail with Java 9 related error, but perhaps caused by Java 16 [message #1839391] Fri, 19 March 2021 18:20 Go to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 800
Registered: July 2009
Senior Member
I've been using 2020-12 since its release with many Java 8 projects. I've been running it with Java 15, but the projects are using the Java 8 JDK. This has been working fine.

I just started setting up 2021-03 today. I set it to run with Java 16. I exported my preferences from the 2020-12 workspace and imported that into the new 2021-03 workspace. I installed all the plugins I normally use.

I then imported all of the projects I need from my git repositories.

When the dust settled, I saw that any attempt to open a Java class failed with the same error:

Quote:
java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @18cf5c52


I'm also seeing a slew of dialogs titled "Multiple problems have occurred", saying "Errors occurred during the build", all repeating that same error message. It got to the point that this dialog would come up as fast as I could dismiss it, as projects seemed like they were in a build loop.

The other oddity is that most of the Java projects had a single compile error, saying that "The project cannot be built until its prerequisite xxxx is built. Cleaning and building all projects is recommended". All of them report the same project name as needing to be built. The even stranger part is that there doesn't appear to be any problem with that project. It has no errors.

At that point, I exited Eclipse. I changed the eclipse.ini file to run it with Java 15. I started it back up. Everything compiled fine. I'm going to move forward with Java 15 for now.
Re: All Java 8 classes opened in 2021-13 fail with Java 9 related error, but perhaps caused by Java [message #1839394 is a reply to message #1839391] Fri, 19 March 2021 19:28 Go to previous messageGo to next message
Eitan Rosenberg is currently offline Eitan RosenbergFriend
Messages: 139
Registered: October 2018
Senior Member
Hi.

Not sure that this will help....

2021-03 does not come out of the box with Java 16 support.

Have you installed Java 16 Support for Eclipse 2021-03 (4.19) ?

https://marketplace.eclipse.org/content/java-16-support-eclipse-2021-03-419

Regards.





Re: All Java 8 classes opened in 2021-13 fail with Java 9 related error, but perhaps caused by Java [message #1839396 is a reply to message #1839394] Fri, 19 March 2021 19:57 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 800
Registered: July 2009
Senior Member
I hadn't before this point. I guess I assumed it didn't matter if I was only using Java 16 to run Eclipse, not for projects.

However, I can't even install it. It chugs for quite a while, saying "Cannot perform operation", and finally fails with an error dialog saying "Problems occurred while performing provisioning operation: operation plan must be resolved
operation plan must be resolved". Here's the error log stacktrace:

!ENTRY org.eclipse.epp.mpc.ui 4 0 2021-03-19 12:53:39.853
!MESSAGE Problems occurred while performing provisioning operation: operation plan must be resolved
!STACK 0
java.lang.IllegalStateException: operation plan must be resolved
	at org.eclipse.equinox.internal.p2.ui.ProvUI.toCurrentJREOperation(ProvUI.java:338)
	at org.eclipse.equinox.internal.p2.ui.ProvUI.toCompabilityWithCurrentJREProvisioningPlan(ProvUI.java:325)
	at org.eclipse.epp.internal.mpc.ui.wizards.MarketplaceWizard.lambda$5(MarketplaceWizard.java:876)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)


I wonder if this particular error is happening because I'm not actually running Eclipse with Java 16 right now. It's using Java 15.
Re: All Java 8 classes opened in 2021-13 fail with Java 9 related error, but perhaps caused by Java [message #1839407 is a reply to message #1839396] Sat, 20 March 2021 06:22 Go to previous messageGo to next message
Eitan Rosenberg is currently offline Eitan RosenbergFriend
Messages: 139
Registered: October 2018
Senior Member
Hi,

Eclipse now includes a JRE.

index.php/fa/40181/0/

Fresh unzip of eclipse-java-2021-03-R-win32-x86_64.zip and fresh work space.

This is my eclipse.ini :

index.php/fa/40182/0/

I installed Java 16 Support for Eclipse 2021-03 (4.19).

Later I add java 16 manually (openjdk-16_windows-x64_bin.zip):

index.php/fa/40183/0/

In the project I change the pom.xml and alt-F5 to update the project.

index.php/fa/40184/0/

The result:

index.php/fa/40185/0/

Your environment is much more complex than mine but since you use java 15 now I am not so sure that the problems relate to modules(java 9 stuff...).

Regards.
Eitan.
Re: All Java 8 classes opened in 2021-13 fail with Java 9 related error, but perhaps caused by Java [message #1839417 is a reply to message #1839407] Sat, 20 March 2021 15:39 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 800
Registered: July 2009
Senior Member
When I referred to "Java 9", I should have referred to "modules", as the error message specifically mentioned that.

I'm aware of the fact that this version comes with a JRE. I chose not to use it, not because I saw any problem with using it, I was just used to specifying my own installation. I'm not aware of any information that indicates the embedded JRE is the one that should or must be used.

Note that I am building projects with Java 8. This issue of mine is only with the JVM used to run Eclipse.
Re: All Java 8 classes opened in 2021-13 fail with Java 9 related error, but perhaps caused by Java [message #1839418 is a reply to message #1839417] Sat, 20 March 2021 16:31 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

An increasing number of platform plugins have moved to Java 11, so the Eclipse IDE is now unusable with a Java 8 JVM. You may however still use the IDE to develop Java 8 and indeed Java 5 applications. You will find that many non-UI plugins retain a much lower BREE. The movement to Java 11 seems to be widespread so there is little point in the Eclipse IDE sticking at Java 8 when the world is moving on.

Regards

Ed Willink
Re: All Java 8 classes opened in 2021-13 fail with Java 9 related error, but perhaps caused by Java [message #1839419 is a reply to message #1839418] Sat, 20 March 2021 18:42 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 800
Registered: July 2009
Senior Member
You didn't need to convince me. It's not as if this was my choice. I occasionally throw the "when are we going to upgrade our JVM?" question up the pole to see how high it goes before it falls down again. So many orgs embrace "if it's not broken, don't fix it", without any consideration of unseen consequences.
Re: All Java 8 classes opened in 2021-13 fail with Java 9 related error, but perhaps caused by Java [message #1842410 is a reply to message #1839419] Thu, 17 June 2021 21:35 Go to previous message
Dirk Steinkamp is currently offline Dirk SteinkampFriend
Messages: 4
Registered: July 2009
Junior Member
Java 16 changed the default for the restricted internal APIs. They are still there but java doesn't allow the access without explicit "opens" for the modules.
That's what your original error message is referencing: 'java.base does not "opens java.lang"'

I stumbled across the same problem with I think RC1 of eclipse 2021-06 that came bundled with the jdk 16. Don't know if it's fixed for the release, but I simply went back to jdk 11 as runtime environment. It doesn't matter if you want to compile your sources with a later jdk -- the eclipse platform itself can easily run with a different version.

If you want to fix the "opens"-problem here's a pattern for some kinds of startup parameters you can add to eclipse.ini -- this is from project lombok, where they stumbled upon the same problem with jdk 16, but it's an example of some command line options that could give you a hint where to continue:

Check out stackoverflow-question 65380359 (sorry, I'm not allowed to paste a link)

If you want to dig in deeper, here's some background in the oracle documentation:

The Oracle-documentation with GUID-7744EF96-5899-4FB2-B34E-86D49B2E89B6 has more information on the background of all this.


If I'd want to use jdk 16 as jre for eclipse I'd download a full package of any flavor, and check out the most recent eclipse.ini -- looking for add-opens lines.
Previous Topic:sending classpath notifications
Next Topic:Eclipse JDT.core breaking dependency change
Goto Forum:
  


Current Time: Thu Mar 28 20:06:36 GMT 2024

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

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

Back to the top