Home » Php » Netbeans PHP – Go to declaration issue

Netbeans PHP – Go to declaration issue

Posted by: admin December 7, 2017 Leave a comment

Questions:

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 defined under <project-root>/foloder00/folder01/folder02/MyClass.php

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

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

Thank you

Answers:

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.
Questions:
Answers:

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

c:\Users{username}\AppData\Local\NetBeans\Cache\

Questions:
Answers:

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.

Cheers

enter image description here

enter image description here

Questions:
Answers:

For linux users:

Delete cache:

  • rm -fR /home/user/.cache/netbeans_vesion

Restart netbeans

Questions:
Answers:

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.

Questions:
Answers:

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.

Questions:
Answers:

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.
Questions:
Answers:

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
    problem:
  • Replace ‘7.1.2’ with your installed version of Netbeans, in directory paths given below.

MAC:
Remove following directory:

 ~/.netbeans/7.1.2/var/cache/

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:

C:\Users\(user)\.netbeans\7.1.2\var\cache

Linux:
Remove following directory:

.netbeans/7.1.2/var/cache

LINK:Here is detailed discussion about the issue

Questions:
Answers:

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

Questions:
Answers:

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.

Questions:
Answers:

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
Questions:
Answers:

I had the same problem and resolved by installing JRE

http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html

Leave a Reply

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