Netbeans IDE 11 cannot access java.lang Fatal Error: Unable to find package java.lang in classpath or bootclasspath

We Are Going To Discuss About Netbeans IDE 11 cannot access java.lang Fatal Error: Unable to find package java.lang in classpath or bootclasspath. So lets Start this Java Article.

Netbeans IDE 11 cannot access java.lang Fatal Error: Unable to find package java.lang in classpath or bootclasspath

  1. Netbeans IDE 11 cannot access java.lang Fatal Error: Unable to find package java.lang in classpath or bootclasspath

    I also had the same issue.
    Solved using manually setting the default jdk.
    open the netbeans.conf from <install_dir>/netbeans/etc
    set the JDK home path for netbeans_jdkhome property
    I am using Ubuntu 19.10

  2. Netbeans IDE 11 cannot access java.lang Fatal Error: Unable to find package java.lang in classpath or bootclasspath

    I also had the same issue.
    Solved using manually setting the default jdk.
    open the netbeans.conf from <install_dir>/netbeans/etc
    set the JDK home path for netbeans_jdkhome property
    I am using Ubuntu 19.10

Solution 1

I also had the same issue.
Solved using manually setting the default jdk.

  1. open the netbeans.conf from <install_dir>/netbeans/etc
  2. set the JDK home path for netbeans_jdkhome property

I am using Ubuntu 19.10

Original Author Sabuj Das Of This Content

Solution 2

After exiting netbeans edit the config file netbeans.conf using

nano ~/netbeans-11.2/netbeans/etc/netbeans.conf

In the line netbeans_jdkhome edit the path like

netbeans_jdkhome="/usr/lib/jvm/java-11-openjdk-amd64"

(Found at askubuntu.com)

Original Author user14095233 Of This Content

Solution 3

After a complete uninstall of my distros Netbeans version, I resorted to installing Netbeans 11 LTS version from the https://netbeans.apache.org/download/nb110/nb110.html into /usr/share/netbeans. This seems to have resolved the issues in the IDE. The program also seems to compile and run faster now.

I was having very similar problems with Netbeans IDE from the Ubunutu/Mint repositories which was still on version 10 the open JDK was version 11. I could not get the IDE to display without errors – but the program would compile and run from the command line fine.

Original Author Frost Metoh Of This Content

Solution 4

If you’re using Maven for the project and OpenJDK the reason could be the way that you define the source and target options in the maven-compiler-plugin. I had a little project build with JDK 1.8 and when I migrated it the maven compiler plugin show me that error.
The solution that worked for me was change the format of the java version on the source and target parameters in maven-compiler-plugin definition:

Before:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.8.1</version>
    <configuration>
        <source>1.7</source>
        <target>1.7</target>
        <compilerArguments>
            <bootclasspath>${sun.boot.class.path}${path.separator}${java.home}/lib/jfxrt.jar</bootclasspath>
        </compilerArguments>
        <showDeprecation>true</showDeprecation>
    </configuration>
</plugin>

After:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.8.1</version>
    <configuration>
        <source>7</source>
        <target>7</target>
        <compilerArguments>
            <bootclasspath>${sun.boot.class.path}${path.separator}${java.home}/lib/jfxrt.jar</bootclasspath>
        </compilerArguments>
        <showDeprecation>true</showDeprecation>
    </configuration>
</plugin>

Original Author Luis Carlos Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

Siddharth

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment