Cannot access java lang netbeans как исправить

I downloaded netbeans ide 11 and tried to do a sample hello world project but it is giving me error "cannot access java.lang Fatal Error: Unable to find package java.lang in classpath or

I downloaded netbeans ide 11 and tried to do a sample hello world project but it is giving me error «cannot access java.lang
Fatal Error: Unable to find package java.lang in classpath or bootclasspath»
I tried some solutions from stack overflow but didnt worked.

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication1;

/**
 *
 * @author ahmad
 */
public class JavaApplication1 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        System.out.println("Hello");
    }
    
}

Main error is
» cannot access java.lang
Fatal Error: Unable to find package java.lang in classpath or bootclasspath

«enter image description here

asked Sep 28, 2019 at 9:15

Ahmad Anis's user avatar

Ahmad AnisAhmad Anis

2,0473 gold badges21 silver badges50 bronze badges

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

answered Jan 22, 2020 at 0:11

Sabuj Das's user avatar

Sabuj DasSabuj Das

2873 silver badges4 bronze badges

1

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)

fcdt's user avatar

fcdt

2,3315 gold badges12 silver badges26 bronze badges

answered Aug 12, 2020 at 18:53

user14095233's user avatar

0

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.

answered Feb 12, 2020 at 16:18

Frost Metoh's user avatar

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>

answered Jan 7, 2021 at 21:05

Luis Carlos's user avatar

Luis CarlosLuis Carlos

3253 silver badges10 bronze badges

I have solved this. First create a folder > install Jdk in this folder > create a new folder inside your first creating folder > install netbeans second creating folder.

answered Oct 14, 2022 at 12:17

Fahad's user avatar

This is driving me crazy:

In Netbeans (6.9.1 on a 64bit Windows 7) with JDK 6 correctly installed, the Editor shows this Error at package my.package.name:

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

The Project compiles just fine, it is just the Editor messing up. Other projects in the same IDE work just fine. Other types of Projects (the errornous is a J2SE Project) work fine.

I tried to Google this, but there are always solutions about that the JDK was not installed right or links to it were corrupt in the project files. This is not the case here. I double and tripple checked the JDK installation: it is ok. Other projects do not show that behaviour in the very same IDE and are using the same JDK.

I diff’ed the project files against correct working project files and could not see any major differences except from those that are expected to be there.

I tried to delete the project and make a new one with existing sources. This works at first glance but once I close the IDE and open it again the same failure will show up.

I tried to revert from SVN to an older version of the project files before this happened: no chance.

In all files of that project I have that error and of course a lot of «cannot find symbol», which prevents also autocomplete and everything.

Does anyone know why this happens and how I can make it stop? It is really more than annoying and I cannot just switch to Eclipse (not my decision).

Any attempt to help will be highly appreciated!

P.S.: Edith just reminded me to tell you that I did not try to reinstall Netbeans since I read in one of the articles I found through Google that it will not help.

Update
This is from netbeans.conf:

netbeans_jdkhome="C:Program FilesJavajdk1.6.0_27"

And it is the only JDK I have so this should be perfectly correct.

Update 2
Loads of Plugins: Ada, Android, Ant, Bundeled Subversion Client for Windows, C/C++, Database, EJB and EAR, GUI Builder, Hibernate, Hudson, IDE Branding, Identity Management, IDE Platform, Java, Java -Debugger, -Persistence, -Profiler, -Web Applications, JSF, Local History, Maven, Mercurial, Mobility, Netbeans Plugin Development, RCP Platform, RESTful Web Services, soupUI WebService Testing, SOAP Web Services, SOftware as a Service, Spellchecker, — English DIctionaries, Spring Beans, Spring Web MVC, Struts, Subversion, Team.

Update 3
Checked rt.jar: It is on the bootclasspath,
build.properties has

platforms.JDK_1.6.bootclasspath=....${platforms.JDK_1.6.home}\jre\lib\rt.jar;...

Reinstalling Netbeans did not change anything.
@JRL : No commandline switches are used.


posted 13 years ago

  • Mark post as helpful


  • send pies

    Number of slices to send:

    Optional ‘thank-you’ note:



  • Quote
  • Report post to moderator

I was using the NetBeans IDE 6.7, however on open an existing mobility project I get lots of red dots,

on rolling over the dot near the package statement it says

‘cannot access java.lang»

Fatal Error:» Unable to find package java.lang in classpath or bootclasspath»

while the other red dots below near other class or Identifier statements say

«cannot find symbol»

I have JDK 1.6.0_14 installed.

I tried the following to correct the errors:

1. Reinstalled JDK 1.6.0_14 .

2. Reinstalled NetBeans 6.7.

3. Uninstalled NetBeans 6.7 and installed NetBeans 6.7.1

However nothing worked.

NetBeans menu Help-> gives the following info:

Product Version: NetBeans IDE 6.7.1 (Build 200907230233)

Java: 1.6.0_14; Java HotSpot(TM) Client VM 14.0-b16

System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)

My Path environment variable is:

C:Program FilesMicrochipMPLAB C30bin;C:MCC18mpasm;C:MCC18bin;C:Program FilesMicrochipMPLAB C30bin;C:Program FilesJavajdk1.6.0_14bin

I also searched google but could not find any valid answers.

What should I do?

Interestingly I get these errors only on Mobility projects and that too on opening an existing Mobility project,

New Mobility and J2SE projects dont give me any errors.

Я пытаюсь установить новые Netbeans (8.1) на jdk 9. Но netbeans не может найти java.lang. Я проверил платформу Java и увидел следующее:
Изображение 181529

в качестве «источников платформы» были добавлены следующие элементы:

C:Program FilesJavajdk1.9.0jrt-fs.jar
C:Program FilesJavajdk1.9.0src.zip
C:Program FilesJavajdk1.9.0javafx-src.zip

но я получаю эту ошибку и не могу заставить ее работать:

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

Заранее спасибо

05 фев. 2016, в 08:35

Поделиться

Источник

2 ответа

Bernhard
07 сен. 2016, в 11:48

Поделиться

  • Откройте вкладку «Проект»
  • Щелкните правой кнопкой мыши по библиотекам.
  • Выберите «Свойства». Отобразятся свойства проекта.
  • в категории Вкладка выберите Источник
  • Установить исходный/двоичный формат в JDK9

это мои свойства проекта, но я использовал JDK8
Изображение 459336

AhmadDani
24 март 2016, в 10:41

Поделиться

Ещё вопросы

  • 0Навигация по слайдеру кодирования
  • 0Что нарушает этот код?
  • 0Простая многодорожечная страница вылетает Chrome.
  • 0Как получить доступ к переменной метки в QMessageBoxPrivate при расширении класса QMessageBox?
  • 0Perl Regex для не HTML
  • 1Javascript ожидает выполнения условия с помощью обещаний
  • 1Обновить AppWidget из программы?
  • 0Перенаправить любой поддомен в основной домен, КРОМЕ конкретных поддоменов
  • 1Как нарисовать поверхность с полярной координатой в C #
  • 0Шаблон столбца Kendo Ui Grid с окном кендо, всплывающим в директиве
  • 1Обработка RunTimeException для класса
  • 1Discord.py как проверить, есть ли у ввода десятичное число
  • 1Функция расстояния Возвращение неправильной вещи
  • 1получить исключение при вставке событий в календарь Android
  • 0Как добавить «Супер» привилегии в базу данных Aurora?
  • 0Процент изображения не ограничен
  • 1Проверьте, загрузил ли канал YouTube видео
  • 1C # Пользовательский тип данных с «выбором»
  • 1Удалить строку Модель объекта ASP.NET MVC ADO.NET
  • 0перегрузка оператора c == isEqual
  • 0Функция синхронизации в JavaScript
  • 0Как передать данные между запросами в угловом ресурсе?
  • 0Конвертировать HTML в XML, используя Java
  • 1Android: стилизация элементов ListView из пользовательского CursorAdapter
  • 0С ++ Шаблонный Функтор
  • 0PHP / MySQL n-ая строка с DATE_SUB и т. Д.
  • 1Холст анимация с JavaScript. Случайные координаты и скорость при каждом запуске
  • 1Как найти имя выходного узла данного файла .ckpt.meta в тензорном потоке
  • 1Ошибка при подключении к Estimote Beacon iOS
  • 1Объединить два файла Config.yml в Java?
  • 1Создайте текстовый файл и разрешите пользователю загружать в приложение светового переключателя
  • 0Задержка анимации ползунка и изменение эффекта на исчезновение?
  • 0php foreach не работает должным образом на объекте json [duplicate]
  • 1Добавление записей в столбцы даты и времени Pandas в Python
  • 0Ошибка CUDA cudaMalloc после запуска ядра с огромными статическими массивами
  • 0php jquery отправляет параметры сообщения на другую страницу php
  • 1Express.js извлечение информации из внешнего API и рендеринг на сайт
  • 0Хотите знать, будет ли это работать как один оператор if () [closed]
  • 0Ссылки меню показывают / скрывают контент в другом div
  • 1Содержимое завышенного EditText
  • 0Spring Boot — Hibernate не сохраняет дату правильно
  • 0Bootstrap 3 Упрощенная головоломка
  • 1Проблема внешней подписи PDF с сертификатом встраивания
  • 0Проверка формы подтверждения магистрали
  • 1Проверка на стороне клиента RequiredFieldValidator для дочернего элемента составного элемента управления
  • 1Как прокомментировать typeparam действия?
  • 0Как получить доступ к типу данных столбца Enum в SQLAlchemy?
  • 1Как открыть Putty Process без него, открывается в другом окне
  • 1Вход в БД Oracle
  • 1np.einsum производительность 4 умножения матриц

Сообщество Overcoder

Понравилась статья? Поделить с друзьями:
  • Candy сушильная машина ошибка e14
  • Candy стиральная машина ошибка sp3
  • Candy посудомойка сброс ошибок
  • Candy плита электрическая ошибка l
  • Candy ошибка е08 как исправить