12

I just installed Netbeans IDE. I am now unable to import any org.* libs and it just says package org does not exist. Also, I imported jdic.jar into the project and even though the code completion suggestions show up as org.jdesktop.*, it shows the same error.

How do I fix this?

Anirudh Ramanathan
  • 46,179
  • 22
  • 132
  • 191

7 Answers7

16

Clearing the cache fixed it. In windows 7 the cache is located in

C:\Users\username\AppData\Local\NetBeans\...

On Linux, the cache is at:

/home/username/.cache/netbeans/...

On clearing the cache, and restarting netbeans, it started to recognize org.* imports again.

Community
  • 1
  • 1
Anirudh Ramanathan
  • 46,179
  • 22
  • 132
  • 191
  • 4
    Windows folks, if you can't find AppData, search for %AppData%. It's normally hidden. – Menefee Jan 03 '14 at 13:27
  • to show hidden files: Open Folder Options by clicking the Start button Picture of the Start button, clicking Control Panel, clicking Appearance and Personalization, and then clicking Folder Options. Click the View tab. Under Advanced settings, click Show hidden files, folders, and drives, and then click OK. – Chris Sim Sep 18 '14 at 11:34
  • 5
    Same problem, but this does not fix it. Netbeans 8.0.2. – Brian Knoblauch Jun 10 '15 at 14:28
  • Same problem, but this does not fix it. Netbeans 8.2 – user3217883 Oct 11 '18 at 22:41
6

I did it easily, just click the Jframe, on Navigator tab, right-click -> Set Layout -> Absolute Layout and YEP, It works for me.

enter image description here

Swayangjit
  • 1,875
  • 2
  • 13
  • 22
PoloClubex
  • 61
  • 1
  • 2
2

org.netbeans.lib.awtextra is part of the AbsoluteLayout library. It should be added automatically by the ide whenever absolutelayout is used in the form. But if you switch to some other layout after using absolute layout, then the jar/library will be removed from the classpath and existing code making calls to the library will not compile.

  • If you would like to use absolute layout, then please include the library in the project. Select 'Libraries' node in the project, right-click and select 'Add Library' and select 'Absolute Layout' library from the list of available libraries.

  • If you do not wish to use absolute layout, then it is best to uncomment/remove code relying on the library and re-do the form design using the new layout.

1

You should redirect all the lost .jar files by exiting netbeans, then reopening it. There should be a prompt asking you to help the IDE find the .jar files. So please do so. If you aren't able to find the jar file. Clean and build the individual packages. There a new directory called a dist directory will be created in the package directory. Now you can redirect them.

1

Can you try importing

import org.xml.sax.Attributes;

This is part of the JDK. If you can't find that, something is really wrong.


I suspect you need to add the libraries to your maven pom.xml file.

Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130
0

Above was not working for me so I tried below and its working:

  1. Google "absolutelayout.jar download"
  2. Download jar
  3. Open NetBeans and Add this "AbsoluteLayout-RELEASE***.jar" file to your project Library folder.
  4. now try to run the project/file
0

in my experience the problem was with a Jpanel with AbsoluteLayout, I put free-design and solved the problem

  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Feb 11 '22 at 07:35