Is there a way to stop NetBeans scanning projects?
I don't have much memory on my PC and a pretty weak processor. Although netbeans is by far my favorite IDE it is almost unbe开发者_如何学JAVAarable to use on my present computer because of the project scanning that starts automatically when I open the program.
Is there a way to prevent netbeans from scanning projects?
Hey George I don't know if this is much of an answer but I right-click and choose 'close' on the projects that I don't need open. There's no point in having all your past projects listed there. Just have the one that you are developing open. You can always reopen the other projects from the menu. Once all the projects you aren't using are closed they won't be scanned each time you start Netbeans.
In addition to creating smaller Projects for the folders you really work on and then a Project Group to group them (Mateng), you can try excluding folders that you will never work on such as images
folders and so on. To ignore those folders, go to:
File > Project Properties > Ignored Folders > Add Folder...
From NetBeans Help:
The Ignored Files property is the opposite of the Include Path. These are files inside the PHP project that you want the IDE to ignore for FTP upload, scanning, etc.
Try this: http://wiki.netbeans.org/ScanOnDemand
Warning: Currently, this plugin only works with development builds. DO NOT use these instructions with an official release...
As soon as you start the NetBeans IDE, the system does so called "up-to-date check" to verify that no files have been changed. If this seems to take too long in your case, and prevents you from performing your work, you may be interested in ScanOnDemand.
The most basic functionality of ScanOnDemand is to disable (potentially long) up-to-date check after start of the IDE. This is done under the expectation that most of the operations with your sources are done from inside the IDE and thus when the IDE is shut down, no important change can happen and thus there is no need to rescan anything. Indeed, this may not be fully accurate, but the fix is easy, in the rare situation where your significantly updated your sources using other tools, just trigger the refresh manually.
Once again the NetBeans IDE gives you more control. You stay in charge, deciding what to do and when...
To help in this area, we decided to create an experimental module, which is available on Update Center (as of release 6.7). The module omits automatic updates in certain situations (e.g. up-to-date check after startup and after switch to main window). The responsibility to invoke rescan and so make the data up-to-date is on the user - via explicit refresh action...
Stop NetBeans scanning projects :
Menu -> Tools -> Options -> Miscellaneus -> Files -> Uncheck Enabel auto-scanning
i know this is an old question but this may help others... To enable or disable background scanning you can find the option under menu Tools -> Options -> Miscellaneus -> Files
https://blogs.oracle.com/netbeansphp/entry/enable_auto_scanning_of_sources
In addition to close unneeded projects (David) you can create project groups containing related projects (or just one):
File > Project Group > New Group...
.
Project groups can then be opened by pointing at them from the same menu. Best of all: Each group remembers which files were open in the editor windows the last time. I organize all my projects into groups and it reduces scanning significantly.
(btw: There's a handy plugin providing a project group shortcut to the toolbar)
Edit: I am also using Scan on Demand for a while now - really good. Kudos for that answer.
I don't know whether you can disable the project scanning or not. Even if you can, I doubt it will ever work properly again. There are a few tips which I have done and it speed up my Netbeans.
- Close Tasks window. This prevents Netbeans to scan for TODO in the comments.
- Exclude virus scanning for *.jar, java folders and netbeans folder. This speeds up my netbeans A LOT.
Netbeans consumes a lot of memory so adding memory also increases its performance (OS does not need to swap between memory and page file when memory is running low) (but this is probably not an option for you). Also, Netbeans consists of hundreds of files which needs to be loaded at start up so the bottom neck is the speed of your hard disk.
For Netbeans 8.*+, the ScanOnDemand plugin from Zeophlite's answer does not work. Use MasterFileSystemSuspend instead, as it is current and works fine on stable releases.
Plugin to control when the NetBeans IDE reacts to changes and when it ignores them. Useful addition to compile on save with additional user actions - by putting the IDE into suspended mode, one can perform (and finish) command line operations and only then turn the IDE on.
The code for the plugin is in main/contrib repository. The plugin can be downloaded from media:Org-netbeans-modules-masterfs-suspend.nbm and installed (Tools/Plugins/Downloaded) into NetBeans 8.0, 8.1, 8.2.
After installation a new icon appears in the toolbar which one can click to suspend the automatic refresh done by the IDE. Very useful when working with Truffle sources in NetBeans 8.2 and newer.
This module is a handy replacement of previous ScanOnDemand module.
On a personal note, this brought my netbeans memory consumption for general use down from 20gb+ during idle to about 2gb consistently, and provides a good workaround for the scanner constantly hanging and leaking memory, particularly in very large projects or those with a ton of symlinks.
This below solved it for me. One project when opened would cause never ending background scanning... this would also mean the code completion etc could never work. My machine was devoting a huge amount of resources to this.
Someone here gave me the clue: right click the project, choose properties, then "Ignored Folders".
Essentially I used this to determine which (specific) folder was the cause of the scanning. I selected the first half, then the second half of the remaining etc a process of elimination... and out of hundreds of folders, I found a (php HMVC view folder that caused it) ... I needed to stop and kill the scanning, then re-start many times...
Here is the easiest way for various reasons:
In the "ignore folders" area, select all the folders and add them all (fairly individually) to the ignore list. Then shut down the ide, and restart. When all background scanning is absent (it starts and runs for a few seconds/minutes normally), begin removing one or a few of the folders. After each removal, close the properties window..... the IDE will quickly scan those folders you removed and will IF no issue with those stop scanning. IF you have just removed the culprit folder, then the scanning will never end...
And another quick thing you can do just delete the nbproject folder inside your project then open the NeteBeans. then the project remove from the list. this I do some times when it got freeze
I've stumbled upon this problem aswell.
The most simple thing is to edit the netbeans config so it doesn't load all your projects. you can always reopen the other projects from the menu. once all the projects you arent using are closed they wont be scanned each time you start netbeans
Solution: Just change the following line in netbeans.conf found under etc folder
# ${HOME} will be replaced by JVM user.home system property netbeans_default_userdir="${HOME}/.netbeans/changeme"
I also face the same problem with netbean 8.2. I just deleted the project by - Right click on the project - Delete the project ( keep unselect delete source code option ). - Again create new project
and its working perfectly now.
Hope its work.
I had almost the same problem with Netbeans IDE 8.2, Windows 10 x64, but in my case It didn't even start my IDE.
- What I did was just go to my Netbeans project folder and cut everything there, then paste into another folder.
- After that, I opened again Netbeans, disabled the auto-scan feature (Menu -> Tools -> Options -> Miscellaneus -> Files -> Uncheck Enabel auto-scanning).
- Then, I went to the folder where I pasted my proyects before and put back on my original Netbeans project folder.
Finally, open your Netbeans IDE and VOILA!.
It worked again :)
Try this Netbeans plugin. This reduces the load for some extend.
http://wiki.netbeans.org/ScanOnDemand
Not exactly the case of question, but sometimes "scanning projects" can be stopped just by restarting Netbeans.
In my case, with jdk 1.8, there is a big issue when there are multiple static imports (see the example). It seems that there is a problem with javac. The compiler is very slow when checking such a .java file and NetBeans scanning is very very slow. It seems that the compilation and scanning time is increasing very fast with each repeated static import. So, if that is your case, just remove repeated imports
package ru.cntp.demo;
import java.math.BigDecimal;
import static java.util.Arrays.asList;
import java.util.List;
import java.util.Map;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.groupingBy;
/**
*
* @author sergiu
*/
public class EmployeeRepository {
public Map<Department, Map<String, Map<String, Map<String, Map<BigDecimal, List<Employee>>>>>> getEmployeesByDepartment() {
Country germany = new Country("Germany");
Department germanyDeptOne = new Department("Dept One", germany);
Employee emp1 = new Employee("Surame", "Name", "Patronymic", BigDecimal.TEN, germanyDeptOne);
return asList(emp1).stream()
.collect(groupingBy(Employee::getDepartment,
groupingBy(Employee::getSurname,
groupingBy(Employee::getName,
groupingBy(Employee::getPatronymic,
groupingBy(Employee::getSalary))))));
}
}
Scanning performance of Netbeans can be improved using the following procedure :
1) Go to Window-->Files. This opens the Files Tab.
2) In the Files Tab for each opened project open the nbproject folder and inside it open the project.properties file.
3) Now in this file below the property "excludes" there are file references listed for all your referred Libraries (JARs)
4) There might be some repeated file references with paths that may be old or on someone else's machine(if you are working in a group and transferred projects from someone's machine)
5) Delete those old path references.
Example -
excludes=
file.reference.xyz.jar=../not/correct/path.jar //delete this line
file.reference.xyz.jar-1=../correct/path.jar //remove -1
....
includes=**
6)Also locate the property "javac.classpath" and delete the unnecessary classpath entries corresponding to the deleted references as described above.
Example -
javac.classpath=\
${file.reference.xyz.jar}:\ //delete this line
${file.reference.xyz.jar-1}:\ //remove -1
....
javac.compilerargs=
7) So now the file reference mentioned in the file reference section and the javac.classpath property is same and points to a valid Library (JAR) address on your machine or network.
Example -
excludes=
file.reference.xyz.jar=../correct/path.jar //the correct reference & path
....
includes=**
....
javac.classpath=\
${file.reference.xyz.jar}:\ //the correct classpath entry for reference
....
javac.compilerargs=
....
The reason the above procedure worked (in my case) is because it prevents Netbeans from scanning unnecessary Library paths that may not be present on your machine/network.
Plugin download - Direct Download
http://wiki.netbeans.org/wiki/images/c/cc/Org-netbeans-modules-scanondemand.nbm
I have the quickest and easiest way.
Just put the netbeans metadata to another location instead of putting it on the project directory
If your project is a Maven structured project you can use a simple trick to make your and NetBeans life a lot easier.
I have my projects inside of c:\dev on my machine. That's the place where Netbeans is working with. If I build in this folder then NetBean's background process get very busy.
But if I copy the c:\dev\trunk project for example to c:\deploy\trunk before I start mvn clean install inside of c:\build\trunk then NetBeans does not need to scan the changes that happen in this folder. It does not know about it.
I use on a windows machine:
robocopy c:\dev\trunk c:\deploy\trunk /MIR /NFL /NS /NC /NDL /XD ".svn"
It is a windows native command. No additional installation necessary.
It helped me a lot decrease build time and also to avoid never ending scans on Netbeans.
If you use tools like JRebel you can still work like this when you update the changed classes to your c:\deploy\trunk folder. You can use the same command.
It is of course a bit of a workaround, but it helps a lot. :-)
My project became Very Big over time
In the below 2 cases, it is too slow:
- While opening NetBeans project - this is too slow
- Automatic scanning of NetBeans project
What did not work for me are:
1. Doing Window > Reset Windows only solves temporarily
2. Sometimes felt my GIT repository integration with Netbeans is the main issue, but there was no clear proof for it
Solution for 1):
Run below commands:
WARNING Below commands have automated delete commands
Close the Netbeans IDE
cd %USERPROFILE%\AppData\Local\NetBeans\Cache\ && del /s /q .\ && rmdir /s /q .\
cd %USERPROFILE%\AppData\Roaming\NetBeans\8.2\var\filehistory\ && del /s /q .\ && rmdir /s /q .\
cd %USERPROFILE%\AppData\Roaming\NetBeans\8.2\var\log && del /s /q .\ && rmdir /s /q .\
And, the problem 1) is now rarely comes up, other times Netbeans loads almost immediately.
Solution for 2):
root
....f1
........f11
........f12
....f2
........f21
........f22
root is a folder and also it's the main NetBeans project
f1, f2 are just folders
f11, f12, f21, f22 are sub-folders that are also NetBeans projects too
Earlier, I was opening root Netbeans project, and the system became too slow due to netbeans scanning the whole project from root, and antivirus was working very hard to cooperate with Netbeans project scanning, result everything in system gets slow.
Now, the solution is open sub-projects like f11, f12, f21, f22, etc. you can open many small sub-project, the Netbeans project scanning issue is fully gone.
My Netbeans 8.0.2 would crash on my Macbook pro due to "Scanning projects..." hogging up my CPU. I couldn't stop the process, however, I could make the process finish quicker by increasing the Java heap memory in netbeans.conf.
$ vi /Applications/NetBeans/NetBeans\ 8.0.2.app/Contents/Resources/NetBeans/etc/netbeans.conf
Replace this:
netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true"
with:
netbeans_default_options="-J-client -J-Xss2m -J-Xms2048m -J-Xmx2048m -J-XX:PermSize=32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true"
精彩评论