"Go to declaration" does not work in Netbeans PHP-ThrowExceptions

Exception or error:

Some of my defined classes are not loaded by the IDE when I call Ctrl+B, Go to declaration, Ctrl+click.

I’m using Windows 7, NetBeans, PHP 7.0.1

My classes are defined under <project-root>/foloder00/folder01/folder02/MyClass.php

I call MyClass <project-root>/index.php

Do you know what the problem is? And the workaround?

How to solve:

As suggested by Nam, it is cache related. So another approach could be to delete the cache:

  1. Close NetBeans
  2. Delete cache folder (by default, on Linux it is located in /home/USER/.cache/netbeans)
  3. Open the project and wait for the scanning project task to finish.


Deleting the Netbeans cache and letting Netbeans rebuild the cache after start fixes the ‘go to declaration’ issue, as suggested by others.

On Windows 7 with Netbeans 8.0 the path to the cache is



I found a workaround for myself. Share with you in case you might need it like me.

Project Property – Include Path – Add the location of the containing folder where it doesn’t work/isn’t loaded.


enter image description here

enter image description here


For Linux users to delete cache:

rm -fR /home/[user]/.cache/[netbeans_version]

Then restart NetBeans.


Go to Tools->Options-> click on PHP Icon on top -> General tab -> find “Global include path” -> Add Folder ->

if(onLinux) { choose /var/www; } if(onWindows) { choose c:\path_to_htdocs or whatever; }

Ah, too much programming for today.. 🙂

For me, this repaired autocompletion and ctrl+click on method call.


I had the same problem with Netbeans 8.0.2.

Clearing the cache had no effect then I noticed the syntax coloring was not working either. The issue was the abbreviated comment tag was not recognized <? and when I changed it to <?php then syntax coloring and Ctrl-B worked again.


If You working with Drupal in NetBeans and have the same ctrl+click (Go to declaration) issue:

  1. Add/associate *.module, *.inc extensions as text/x-php5 files
    (NetBeans > Options > Miscellaneous > Files).
  2. Close NetBeans.
  3. Clear NetBeans cache (as described above).
  4. Open the project and wait for the scanning project task to finish.


I resolved this issue deleting the nbproject directory on my project.

After deleteting this directory, just restart your ide.
It’ll start going to declarations, functions and classes again.


In windows system, we cannot see the AppData folder directly.
So we need to browse the below given path to delete the Netbeans cache:
Delete the cache folder.
If it still doesn’t work then delete the sub-folders inside
Then reopen your netbeans and let it scan projects.


I encountered the same problem on Mac, I solved it by deleting netbeans cache directory:

  • Close netbeans, Find and delete Cache directory of netbeans, it will solve your
  • Replace ‘7.1.2’ with your installed version of Netbeans, in directory paths given below.

Remove following directory:


command:rm -rf ~/.netbeans/7.1.2/var/cache/
enter image description here

Windows XP:
Remove following directory:

C:\Documents and Settings\(user)\.netbeans\7.1.2\var\cache

Windows Vista / 7:
Remove following directory:


Remove following directory:


LINK:Here is detailed discussion about the issue


For me Ctrl + Click does not work when I choose ‘Put NetBeans metadata into a separate directory’ when doing PHP in Netbeans 7.3.1 on Ubuntu


I had the same problem on ubuntu 16.04 and I solved it doing what was written here

  • Edit netbeans.conf (on Ubuntu 16.04 /etc/netbeans.conf)
  • Add the --cp:p /usr/share/java/jcodings.jar to netbeans_default_options


I had the same problem and resolved by installing JRE



For me, deleting the Cache didn’t work. Deleting and recreating the project did.

For what it’s worth, my Cache directory lives here:


I’m using NetBeans 8.1 in Windows 7.


For me, deleting the Cache folder did not work.

Then i realized that the source files that i have opened in NetBeans, were not included as part of a project. So i went ahead and selected: File > Open Project > chose the original project folder in my htdocs (XAMPP).

Then the declaration mapping worked like a charm. Hope it helps someone out there.


I got the same issue in Netbeans 11.0.
My OS is Ubuntu 18.04.
I solved the issue by clearing the cache of netbeans.
Cache path of Netbeans 11 is



Go to Tools->Options-> click on PHP Icon on top -> General tab -> find
“Global include path” -> Add Folder -> .

This worked for me on netbeans 11 also

Leave a Reply

Your email address will not be published. Required fields are marked *