Getting the following error, after adding Lombok lib

An error has occurred. See error log for more details.
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 @1d1c37d5
10

There are 10 best solutions below

12
On BEST ANSWER

Add the below lines to the end of the eclipse.ini file

--illegal-access=warn
--add-opens=java.base/java.lang=ALL-UNNAMED
0
On

For my case nothing above work for a specific project.

  1. Import existing maven project or create a maven project
  2. Goto project explorer and Right click on your pom.xm then select Run As maven install.
  3. and then what you want.

Hope it will serve your purpose. You can download a sample spring boot project from sample spring boot project

Or you can run a maven project from terminal or cmd. Just goto project root folder and then run a maven task like maven clean install . Happy Coding :)

0
On

Itseems problem with the lombok plugin. I have removed it from the eclipse.ini file and it resolved the issue.

Removed below line:

-javaagent:C:\<location>\eclipse-jee-2022-03-R-win32-x86_64\lombok.jar
1
On

The only thing that worked for me was downloading the lombok directly from lombok website instead of using the one available on maven folder.

6
On

Updating to Lombok 1.18.22 plugin resulted in this issue going away for me. I did try adding the --add-opens flag, but the eclipse launcher balked at that. IMHO this is simply a result of incompatibility between Java 17 and the Lombok Eclipse IDE plugin.

0
On

I was also facing same issue after configured lombok in STS 4.17.2.RELEASE.

I have removed below properties from ini file.

--add-opens=java.base/java.io=ALL-UNNAMED
--add-opens=java.base/sun.nio.ch=ALL-UNNAMED
--add-opens=java.base/java.net=ALL-UNNAMED
--add-opens=java.base/sun.security.ssl=ALL-UNNAMED
-Dsun.java.command=SpringToolSuite4

I have tried many solutions but not worked. So, I have compared with my older sts version.

Honestly, I don't know actual reason.

0
On

you would need to check which java exe your IDE is pointing to in the .ini file. In other words, Just point your eclipse.ini to the right java.exe folder then the error goes away. This works for me in Spring STS and "may be" this same remedy will work in Eclipse too.

2
On

In MyCase I have added the above 2 lines in .ini file and I changed the Java version from 1.8 to 11 then it's start working

0
On

I had the same issue that mentioned above. When I downloaded new version of lombok.jar, it resolved my issue.

2
On

In my case, I solved changing java version from 16 top 11.
Adding this line:
--illegal-access=warn
--add-opens java.base/java.lang=ALL-UNNAMED

in my case, eclipse is not enable to start. Version: 2021-03 (4.19.0) Build id: 20210312-0638