Home > NetBeans, Uncategorized > Clear your cache in NetBeans

Clear your cache in NetBeans


There’s a problem I’ve run into in NetBeans once or twice where NetBeans places red underlines signalling compile errors in your projects, but the project actually builds and runs fine.  It’s very irritating, and I’m not sure what causes it, but from what I’ve been able to find online it’s caused by a corrupted cache (the editor view thinks the file cannot be compiled due to some stale information).  To fix this, execute the following command in the terminal

rm -rf /path/to/netbeans/6.8/var/cache/

(replacing 6.8 with the version of Netbeans you’re running)

  1. i82much
    June 21, 2010 at 9:43 am

    The path/to/part can be tricky. It’s probably ~/.netbeans

  2. i82much
    June 21, 2010 at 9:48 am

    Once again had to clear my cache when my JUnit tests started being unable to find the classes being tested..

  3. anil
    June 14, 2011 at 1:56 am

    i am using netbeans7.0 & i m not getting any var folder in netbeans 7.0. Even cache is also not there

    • i82much
      June 14, 2011 at 8:05 am

      This article concerns NetBeans 6.9. Not sure the directory structure for NetBeans 7

    • January 20, 2012 at 6:45 am

      It’s the same folder but version 7.0 …
      On windows -> C:\Documents and Settings\(user)\.netbeans\7.0\var

  4. regular_user
    June 29, 2011 at 12:32 am

    if you’re on WindowsXP it’s something like :
    C:\Documents and Settings\username\.netbeans\7.0\var\cache

  5. July 22, 2011 at 4:55 pm

    This seems to work for me:
    find . -name “*.java” -exec touch {} \;

    • i82much
      July 22, 2011 at 7:49 pm

      Interesting. Not sure why touching the files would fix the problem… but glad it does

  6. Cristian Ortiz
    August 28, 2011 at 9:34 pm

    hey guys on windows vista or 7. is located at
    C:\Users\ChiperOrtiz\.netbeans\6.9\var

  7. Andrew
    August 29, 2011 at 4:51 pm

    I can verify that this fixed my problem on Linux with Netbeans 7.0.1. My home directory had a “.netbeans/7.0/var/cache” folder. I closed Netbeans, erased the cache directory, and reopened Netbeans. It rescanned all my projects and everything worked correctly from there.

    Thanks!

  8. kanchan
    March 24, 2012 at 9:30 am

    are we suppose to erase the cache directory comletely

    • Nick
      March 24, 2012 at 9:34 am

      Yes, do a rm -rf.

      Nick

  9. kanchan
    March 24, 2012 at 9:43 am

    should i delete the index folder

    • Nick
      March 24, 2012 at 10:14 am

      Delete everything in that folder. If index is in the folder, then yes delete it

      Nick

  10. Brad
    November 15, 2012 at 8:35 pm

    These questions were not sufficiently answered:

    “Should i delete the index folder”
    “are we supposed to erase the cache directory completely”

    Same questions, just worded weakly – what they appear to want to know is – are we supposed to delete the contents of the “cache” folder _AND_ the “cache” folder itself. This was the first query i also had.

    The answer is, yes, you may delete the folder named “cache”, though i suspect this has little impact apart from a routine check of existing namespaces to ensure the folder is recreated.

    This also fixed my problem with Netbeans suddenly not knowing any of my Class/Function/Method names and parameters when “CTRL-SPACE” is pressed, so thank you to all who posted!

  11. hyper6teen
    January 6, 2016 at 1:20 pm

    i have a problem about stuck at running project. so i found this forum. but then this is already 3 years old. and i am using 8.1 netbeans now. for those people who are directed here and looking for the cache folder on windows 7. it is located at C:\Users\(User account name)\AppData\Local\Netbeans\Cache. hope this one help.

  1. May 5, 2018 at 9:38 am
  2. April 10, 2020 at 4:05 am

Leave a comment