Pregunta

I created a project in NetBeans, and I would like to clear the NetBeans cache.

I'm running NetBeans 7.0.1 on a Windows 7 machine.

How do I do this?

¿Fue útil?

Solución

Before 7.2, the cache is at C:\Users\username\.netbeans\7.0\var\cache. Deleting this directory should clear the cache for you.

Otros consejos

Close NetBeans before deleting the cache.

NetBeans 7.2+, Windows 7

Cache is located in C:\Users\<username>\AppData\Local\NetBeans\Cache\.

Clear the cache using the %USERPROFILE% Windows variable:

del /s /q %USERPROFILE%\AppData\Local\NetBeans\Cache\

If it is set, you can also use the environment variable %LOCALAPPDATA%:

del /s /q %LOCALAPPDATA%\NetBeans\Cache\

NetBeans 7.2+, Linux

Cache is at: ~/.cache/netbeans/${netbeans_version}/index/

Mac OS X

Cache is at: ~/Library/Caches/NetBeans/${netbeans_version}/

See also http://wiki.netbeans.org/FaqWhatIsUserdir.

Help Menu

On Windows, selecting the Help » About menu will display a dialog that contains the following text:

Product Version: NetBeans IDE 8.0.2 (Build 201411181905)
Java: 1.7.0_80; Java HotSpot(TM) 64-Bit Server VM 24.80-b11
Runtime: Java(TM) SE Runtime Environment 1.7.0_80-b15
System: Windows 7 version 6.1 running on amd64; Cp1252; en_CA (nb)
User directory: C:\Users\Username\AppData\Roaming\NetBeans\8.0.2
Cache directory: C:\Users\Username\AppData\Local\NetBeans\Cache\8.0.2

Regardless of operating system, the About dialog will contain the correct path to the cache directory.

The path of the cache directory is listed in the About window (menu Help/About). Close NetBeans, then delete (or rename) the directory. NetBeans will rebuild its cache when it starts up.

On a Mac with NetBeans 8.1,

  1. NetBeansAbout
  2. Find User Directory path in the About screen
  3. rm -fr 8.1 In your case the version could be different; remove the right version folder.
  4. Reopen NetBeans

I'll just add that I have tried to resolve reference problems caused by a missing library in the cache, and deleting the cache was not enough to solve the problem.

I closed NetBeans (7.2.1), deleted the cache, then reopened NetBeans, and it regenerated the cache, but the library was still missing (checked by looking in .../Cache/7.2.1/index/archives.properties).

To resolve the problem I had to close my open projects before closing NetBeans and deleting the cache.

For Netbeans 7.4 and above in Linux, the cache is $HOME/.cache/netbeans/7.4.

In Window 7 the cache is located at C:/Users/USERNAME/AppData/Local/NetBeans/Cache

The NetBeans cachedir is a directory consisting of files that may become large, may change frequently, and can be deleted and recreated at any time. For example, the results of the Java classpath scan reside in the cachedir.

NetBeans 7.1 and older By default the userdir is inside a (hidden) directory called .netbeans stored in the user's home directory. The home directory is ${HOME} on Unix-like systems, and %USERPROFILE% (usually set to C:\Documents and Settings\) on Windows. The cachedir can be found in var/cache subfolder of the userdir. As the name suggests, the userdir is unique per user. For each version of NetBeans installed, the userdir will be a unique subdirectory such as .netbeans/. To find out your exact userdir location, go to the IDE's main menu, and choose Help > About. (Mac: NetBeans > About NetBeans). NetBeans 7.1 allows to separate the cache directory using a switch --cachedir to a desired location.

Examples A Windows user jdoe running NetBeans 5.0 is likely to find his userdir under C:\Documents and Settings\jdoe.netbeans\5.0\ A Windows Vista user jdoe running NetBeans 5.0 is likely to find his userdir under C:\Users\jdoe.netbeans\5.0\ A Mac OS X user jdoe running NetBeans 5.0 is likely to find his userdir under /Users/jdoe/.netbeans/5.0/ (To open this folder in the Finder, choose Go > Go to Folder from the Finder menu, type /Users/jdoe/.netbeans/5.0/ into the box, and click Go.) A Linux user jdoe running NetBeans 5.0 is likely to find his userdir under /home/jdoe/.netbeans/5.0/

For More Info

See this documentation at the NetBeans site: NetBeans 7.2 and newer

For NetBeans 8+ on Windows 10 there's a definitive bug with duplicate classes error which is being solved by cleaning the cache at C:\Users\<user>\AppData\Local\NetBeans\Cache.

Just install cache eraser plugin, it is compatible with nb6.9, 7.0,7.1,7.2 and 7.3: To configure the plugin you have to provide the cache dir which is in netbean's about screen. Then with Tools->erase cache, you clear the netbeans cache. That is all, good luck.

http://plugins.netbeans.org/plugin/40014/cache-eraser

tl;dr You might not need to whack your entire NetBeans cache.


My problem manifested as running a clean build didn't delete the previous build folder or testuserdir folder, while I was using NetBeans 8.0.2.

The first time I had this problem, Ray Slater's answer above helped me immensely. I had two Project Groups, and had to close each project in both groups, close NetBeans, clear the cache, then add my projects back to my groups before it would work again.

Later, this problem cropped up again with NetBeans 8.1. I closed NetBeans, and ran ant build clean at the command line, and it worked. When I reopened NetBeans, the problem was resolved. It occurs to me that NetBeans was keeping something open and just needed to be closed in order to delete the folders.


Update
I finally figured out what was going on. Somehow, my NetBeans "Module Suite Project" (yellow/orange puzzle pieces icon) had been closed and the "Module Project" (purple puzzle piece icon) having the same exact name as the "Module Suite Project" was open. Building clean cleaned that particular Project correctly, but did not clean the entire Suite.

Now that I have the "Module Suite Project" opened correctly again, things work as expected. This explains why ant build clean worked, since it was done on the command line at the right level to clean the whole Suite.

I suspect I didn't strictly need to clean out my NetBeans cache at all though perhaps doing so actually fixed the issue of why it was only showing the "Module Project" instead of the "Module Suite Project", thereby doing the right thing when I clicked build clean... If I had simply realized that the Suite was no longer open and only the Project was, I could have fixed it in three seconds.

The cache is C:\Users\userName\AppData\Local\NetBeans\Cache\, and then the version name of the folder will specify the correct cache.

You can also do this: Close the IDE. Instead, of deleting files and risking everything, rename this cache folder. Now start the IDE. Once it starts, a new cache folder will be created since the folder is not found. Now you can delete the renamed folder safely.

I have tried this

UserName=radhason

C:\Users\radhason\AppData\Local\NetBeans\Cache

enter image description here

Press Ok button , then cache folder will be shown and delete this cache folder of netbeans.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top