Java Netbeans: "Package Does Not Exist"

I have a problem with my code, although it has not been modified in any way. He just unexpectedly threw this message. As you can see on the left, they are all in the correct package and have the correct names.
What can I do to fix this problem?

enter image description here

+5
source share
3 answers

Clear cache to fix it. On Windows, the cache is located at:

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

On Linux, the cache is located at:

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

After clearing the cache, restart netbeans.

+11
source

If clearing the cache still does not work, try adding the jar themselves files themselves instead of adding a folder. Sounds like a bug in Netbeans. I did it this way and worked like a charm.

0
source

I had several compiled classes from the JAR that I wanted to include in my project. I created a new package, added the corresponding classes to it, and received this error "package does not exist" when trying to import a new package.

If you add compiled Java classes and get this error, here is how I solved it:

  1. Create package

  2. Add a new (empty) Java class (.java file) to the package using the same name as the compiled Java class.

  3. At this point, you should see that your broken links to the "package does not exist" or to the class file that you just added are fixed.

  4. Delete the new .java file and NetBeans should still see the package with the newly added classes.

0
source

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


All Articles