17
votes

I hope I post that question in correct place.

Since a few days I have a problem with Netbeans 8.2 (fresh installation)

Java 1.8.0_162.

Operating system: Windows 7/10 . The problem occurs on three different computers.

Steps to reproduce:

  • Open any file in Netbeans IDE (the editing caret is blinking),
  • Deactivate NB window (click on another window, notepad, browser doesn't matter),
  • Back to NB again by clicking directly on opened document (caret is blinking again),

Now you should notice CPU usage. To make it lower click on "Output" panel.

SOLUTION FOR THIS ISSUE

Found a solution for this problem. I installed older vesion of JDK 8u144 and set netbeans_jdkhome variable in <netbeans install directory>/etc/netbeans.conf, so it points to that version. Now everything works correctly, no CPU usage at idle.

As ImtiazeA noticed Netbeans works fine without this issue with JDK 8u172 installed (thanks for your answer). They must have fixed it :) So just dont use 8u152 and 8u162 and it will be good.

EDIT

Deactivated all installed plugins and still the same problem.

Installed Netbeans 8.0 - didn't help...

Downloaded the Dev version of netbeans and got the same issue. Now using IDE Profiler and got this message:

java.awt.IllegalComponentStateException: component must be showing on the screen to determine its location
    at java.awt.Component.getLocationOnScreen_NoTreeLock(Component.java:2062)
    at java.awt.Component.getLocationOnScreen(Component.java:2036)
    at javax.swing.text.JTextComponent$InputMethodRequestsHandler.getTextLocation(JTextComponent.java:4643)
    at sun.awt.im.InputMethodContext.getTextLocation(InputMethodContext.java:278)
    at sun.awt.windows.WInputMethod$1.run(WInputMethod.java:588)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
    at java.awt.EventQueue$4.run(EventQueue.java:733)
    at java.awt.EventQueue$4.run(EventQueue.java:731)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
    at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
[catch] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
8
Interesting. Like you, I am running Win10, NB 8.2, Java 1.8.0_162 but do not see this issue. When I open a file (your step 1 above) CPU usage for NB briefly rises to somewhere between 5% and 15%, but then goes back down to < 1% within a couple of seconds. Perhaps try opening many different types of file (*.xml, *.js, *.css large *.java file vs small *.java file, etc.) to see if any pattern emerges? Also do you see this issue every time you open a file, or only on the first occasion within a NetBeans session? - skomisa
Also, a couple more things to try: [1] Click IDE Log on the View menu to check for any issues with NB. [2] Try downloading/installing the latest DEV build of NetBeans to check whether you see the CPU problem there as well. You can safely install/run two versions of NB concurrently. See bits.netbeans.org/download/trunk/nightly/latest - skomisa
I will try to install latest development build - didn't saw that option before, thanks for the tip. CPU usage raises after I switch between windows (Netbeans and other opened application). It is hard to describe it. When I will have time I will post simple video to show it.. - Krzysztof
Same problem. High CPU without any reason, even mouse pointer is flickering on NB first start. In order to solve this, completely deleted java, Netbeans and appropriate files with Revo, installed everything once again, but nothing helped. What changed besides new Jdk installation was Windows update, and maybe that is the reason. - dobrivoje
Installing JDK 8u144 and setting netbeans_jdkhome variable in <netbeans install directory>/etc/netbeans.conf worked for me. Thanks a bunch - nenea

8 Answers

14
votes

Someone somewhere said that it's a problem with Tasks pane somewhere in background doing something. Turn it on and then off in Menu/Window/Tasks, and your computer will start breathing again for a while.

For me, Ctrl-Shift-6, Ctrl-W is a new involuntary action.

If they don't fix that in the next seven years, I'm switching to another IDE. That's the maximum I'm giving them.

4
votes

I have the same problem. What seems to be happening is Netbeans is constantly checking the selected code window for compile and syntax errors, even when Netbeans is minimized. My solution is to not delete the Start Page tab that appears when you start Netbeans. Then before minimizing, select this tab and the CPU usage drops to 0.

3
votes

For those who did not notice the solution Krzysztof mentioned in the question, I installed another JDK and it fixed my issue. I just installed the latest JDK 8u172 (instead of 8u144) and it worked for me.

1
votes

Another possible reason: Large amount of data in clipboard.

My NetBeans was consuming more than 70 % of CPU. I followed advice from a comment above and opened IDE Log from View menu. There I got the following error:

java.lang.OutOfMemoryError: OutOfMemoryError at
  sun.awt.windows.WClipboard.getClipboardData(Native Method) 

Switching to another window, selecting few characters and Ctrl-C resolved the issue.

0
votes

Just to mention that I work on Intel i5 and Windows10-64bit. I tried literally everything. After one of those system updates, my Netbeans 8.2 influenced a system to be very slow, almost to the point of unresponsiveness. During NB startup or build, system is practically unresponsive. So, all possible tweaks both Netbeans and Java, couldn't solve a problem. It seems that Windows update itself trigger off a problem to happen, as updates did changes on low system level, I suppose. I decided to lower a Netbeans PID, by creating new shortcut like this :

cmd.exe /c start "Netbeans 8.2 LowPrio" /Low "C:\Program Files\NetBeans 8.2\bin\netbeans64.exe"

For now I can work without disruption, and it's far more smoother, than before.

https://gist.github.com/dobrivoje/2af15a84dbd3179938e0fbf288d512b4

0
votes

I found a solution for this. Atleast that worked for me. I was having same issue. My solution is to remove your netbeans inner folder from AppData and try restarting netbeans. It works perfect now. My path is C:\Users\awais\AppData\Roaming\NetBeans Remove 8.1 or 8.2 folder and restart netbeans.

0
votes

I had the same problem suddenly, but the problem was Windows 10 Dark mode, after switch back to Light color scheme on windows 10 it was normal as before.

TIP: You can profile the netbeans and check which consume more resources.

0
votes

Canceled the unpacking index task that seemed to be stuck. (bottom right of screen)