1

Just installed NetBeans and created a new void project with the create Main class checkbox checked, and a second after creating the project I get this error:

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

just over the package javaapplication3; line.

And also (probably because of the first problem):

Cannot find symbol symbol class String

every time I try to use the type String.

Error Screenshot:

enter image description here

I know there are similar questions to this, but I have already tried to:

  • Clean and compile
  • Delete cache
  • Reboot
  • Uninstall and reinstall NetBeans
  • Add the main class manually

I'm using NetBeans 10.0 on elementaryOS.

skomisa
  • 16,436
  • 7
  • 61
  • 102
Francesco
  • 31
  • 1
  • 8
  • [1] What do you see when you expand the `Libraries` node for your project in the screenshot? [2] Does the other project in your screenshot have the same problem? [3] Which version of Java are you using? [4] Is there anything of relevance in the NetBeans log (**View > IDE Log**)? – skomisa Nov 25 '19 at 00:25
  • [1]JDK 11 (default), but when I expand it... nothing [2]yes, all projects, new or imported [3]open jdk 11.0.4 [4] yes, haven't noticed it before: WARNING [org.netbeans.modules.java.source.tasklist.IncorrectErrorBadges]: Incorrect error badges detected, file=/home/francesco/NetBeansProjects/JavaApplication1/src/javaapplication1/JavaApplication1.java. WARNING [org.netbeans.modules.java.source.tasklist.IncorrectErrorBadges]: Going to recompute root=/home/francesco/NetBeansProjects/JavaApplication1/src, files in error=[]. – Francesco Nov 25 '19 at 14:50
  • OK. Can you select your project in the **Projects** panel and right click to open its **Properties** window, then: [1] Click **Libraries**. What do you see in the drop list for **Java Platform**? If there is an error can you select anything to resolve it? [2] Click **Sources**. What do you see in the **Source/Binary Format** field? If there is an error can you select anything to resolve it? [3] Select **Tools > Java Platforms**. Is everything OK for your JDK 11 platform? [4] Not sure if it is relevant for you, but see [Netbeans doesn't start](https://elementaryos.stackexchange.com/q/17382). – skomisa Nov 26 '19 at 02:07
  • [1] only JDK 11 (default) makes sense, it's the only one I have [2]JDK 11, but I could select previous versions up to 6 (quite sure I won't need to do it) [3]Platform name: JDK 11 (default) as always, and the path is right, BUT, in the platform modules list, I there are some java.something, but there isn't any java.lang (that is exactly what the error is about), I don't see how it can compile if he doesn't find that module but somehow he does, not sure if it may help but when I try to run the program, net beans doesn't find the main class [4]no, that's not my case – Francesco Nov 26 '19 at 18:39
  • Probably this will help: under **Tools -> Java Platforms -> Sources** there is no platform source, but in: _/usr/lib/jvm/openjdk-11_ there is a file called src.zip (wich is a source file i guess), but if I try to add it, the window add JAR/folder just disappear after I click on the add JAR/folder button and then the file is not added, tried to decompress it seems like no file exctractor can see it – Francesco Nov 26 '19 at 19:33

0 Answers0