简体   繁体   中英

NetBeans error: package org does not exist

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?

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.

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.

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.

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.

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

在此处输入图片说明

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM