"cannot access java.lang" - Error in Netbeans 6.9.1

It drives me crazy:

On NetBeans (6.9.1 on 64-bit Windows 7) with the correct installation of JDK 6, the editor shows this error in the my.package.name package:

unavailable java.lang
Fatal error: Unable to find java.lang package in classpath or bootclasspath

The project compiles just fine , it's just a buster. Other projects in the same IDE work very well. Other types of projects (faulty J2SE project) work fine.

I tried to do this by Google, but there are always decisions that the JDK was not installed correctly or the links to it were damaged in the project files. Not so here. I double and triple checked the JDK installation: this is normal. Other projects do not show this behavior in the same IDE and use the same JDK.

I matched the project files with the correct project working files and did not see any significant differences other than those that are expected to be there.

I tried to delete the project and create a new one with existing sources. This works at first glance, but as soon as I close the IDE and open it again, the same failure will appear.

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

In all the files of this project, I have this error and, of course, there is a lot of โ€œcanโ€™t find the characterโ€, which also prevents autocompletion.

Does anyone know why this is happening and how can I make it stop? This is really more than annoying, and I can't just switch to Eclipse (not my solution).

Any attempt to help would be greatly appreciated!

PS: Edith just reminded me that I was not trying to reinstall Netbeans, as I read in one of the articles I found through Google that this would not help.

Update
This is from netbeans.conf:

netbeans_jdkhome="C:\Program Files\Java\jdk1.6.0_27" 

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

Update 2
Plugin download: Ada, Android, Ant, Bundeled Subversion Client for Windows, C / C ++, databases, 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 plug-in development, RCP platform, RESTful web services, soupUI web services testing, SOAP web services, software like service, spell checking, - English broadcasters, Spring Beans, Spring Web MVC, Struts, Subversion, Team.

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

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

Reinstalling Netbeans has not changed anything.
@JRL: command line switches are not used.

+4
source share
2 answers

Ok, I don't know why this worked, but it worked:

  • I closed Netbeans
  • I switched to "C: \ Users \ MyUser.netbeans \ 6.9 \ var"
  • I renamed the cache folder
  • Restarted Netbeans
  • Profit?

Somehow this folder was still present after reinstallation. Got this review from a colleague. He does not know the exact reason why this behavior appears and why it goes away when you force Netbeans to recreate the cache. But it works.

Many thanks to all of you for helping me!

+1
source

If this error occurs for an imported project , then you can skip Target-JDK for this project.

In Project Explorer, right-click on the affected project and select Properties. Now go to the "Libraries" section. As you can see in the screenshot, JDK 1.6 was selected for this project, but this JDK is not available on the current computer.

Project Properties Screenshot

Decision:

Install the required JDK and add it through the "Manage platforms ..." dialog box in the project properties or check the compatibility of the project with the installed JDK. To do this, select the installed JDK from the Java Platform drop-down list and try to compile the project. Please note that the latter solution may lead to errors or unexpected behavior!

+1
source

Source: https://habr.com/ru/post/1386728/


All Articles