[Fixed] build fail , "'com.sun.tools.javac.tree.JCTree qualid'" error occur – Java

by
Alexei Petrov
java java-12 spring-boot thingsboard

Quick Fix: For the issue ‘com.sun.tools.javac.tree.JCTree qualid’, make sure to have the correct JDK version (e.g., 1.18.24) configured in your project settings (check in File > Project Structure > Project Settings).

The Solutions:

Solution 1: Install Java Development Kit (JDK) 17

The error message “java.lang.NoSuchFieldError: Class com.sun.tools.javac.tree.JCTree$JCImport does not have member field ‘com.sun.tools.javac.tree.JCTree qualid'” indicates that the Java compiler is unable to find the required field in the JDK. To resolve this issue, ensure that you have JDK 17 installed on your system.

Follow these steps to install JDK 17:

  1. Go to the Oracle JDK 17 download page.
  2. Select the appropriate version of JDK 17 for your operating system.
  3. Click on the "Download" button.
  4. Run the downloaded installer and follow the on-screen instructions to complete the installation process.

Once JDK 17 is installed, update the project’s JDK settings to use JDK 17.

  • For IntelliJ IDEA users:
    Go to "File" > "Project Structure" > "Project" > "Project SDK" and select JDK 17.

  • For Maven users:
    Add the following dependency to your project’s pom.xml file:

<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
    <version>1.18.24</version>
</dependency>

After updating the JDK and Lombok version, rebuild your project. The error should be resolved.

Q&A

What is the solution for the error "java.lang.NoSuchFieldError: Class com.sun.tools.javac.tree.JCTree$JCImport does not have member field ‘com.sun.tools.javac.tree.JCTree qualid’"?

Try using JDK 17 and Lombok dependency version 1.18.24.

What could be a possible cause for this error?

It could be related to a version mismatch between JDK and Lombok.

How would you resolve this error?

Set JDK to version 17 and update Lombok dependency to version 1.18.24.

Video Explanation:

The following video, titled "Command failed with exit code 1: npm run build - Netlify fix 2020 ...", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

Udemy Courses: - 9 React Projects on Udemy - https://bit.ly/2D83M8c - 9 React Projects on Gumroad - https://h3webdevtuts.gumroad.com/l/oOgYi ...