NetBeans is sluggish/unresponsive

10,425

Solution 1

Look & Feel:

GTK+ and Java Swing Applications do not play well at all together when it comes to look and feel. I am afraid we'd have to wait for Java 8 for a proper fix.

For the time being, if you're not using Kubuntu but Ubuntu and Unity, you have to switch to the native look and feel which is Metal.

Go to your netbeans directory (ex: /home/user/netbeans7.2/etc) and open the file : netbeans.conf

then add the following line to netbeans options:

-J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=lcd --laf Metal

Netbeans in Ubuntu 12.04 using Metal LAF

Source: http://hanynowsky.wordpress.com/2012/04/27/netbeans-ide-look-feel-under-ubuntu-12-04/

Global menus: Java Swing applications cannot benefit from Global menus integration for now. For the same reason: GTK/Swing implementations. Even Eclipse IDE is blacklisted for now even though it's SWT and not Swing based. Same goes for Emacs and Lotus notes. Nevertheless, you can activate Global Menu support for Java Swing applications by using Java Ayatana Library and for netbeans install the corresponding plugin : http://hanynowsky.wordpress.com/2012/05/12/integration-of-java-swing-applications-with-unity-global-menu-in-ubuntu-12-04/ By the way, it would be ideal if OpenJDK crowd include this same library in OpenJDK's next version so that Swing Application get support for Global Menu out of the box.

Slowliness: I use Netbeans IDE frequently on my machine and it's not slow at all compared to Eclipse. It might be an issue with the version packaged for Ubuntu Software Center (repos). I don't recommend it. Instead, download Netbeans 7.1.2 from Netbeans.org and install it locally on your home directory. You'll notice that it's faster than the version in repositories. Slowliness might also occur when you're using OpenJDK instead of Oracle JDK (Tested).

Solution 2

I've just upgraded to Kubuntu 12.04 and there is no problem with NetBeans IDE what so ever. The reason my be that Kubuntu is KDE based distribution and NetBeans IDE is by default using Metal L&F.

In my opinion, you can improve your NetBeans experience under GTK by forcing it to use Metal L&F. The command line options is --laf Metal (or something like that).

Solution 3

This seems to be a problem of the default Adwaita theme (and probably others as well). The gtkrc for GTK2 application causes problems to GTK LAF and prevents rendering separators and menu borders. Obviously, in some cases it may also cause UI sluggishness (even though I haven't experienced it)

By tweaking the gtkrc file I was able to resolve the problem.

================================================================================

Replace the following 3 style sections in the gtkrc :

style "menu" {
    xthickness = 1
    ythickness = 1

    bg[NORMAL]        = shade (1.08, @bg_color)

    engine "clearlooks" {
        radius = 0.4
    }
}

style "menu_item" {
    xthickness = 2
    ythickness = 3

    fg[PRELIGHT]      = @selected_fg_color
}

# This style is there to modify the separator menu items. The goals are:
# 1. Get a specific height.
# 2. The line should go to the edges (ie. no border at the left/right)
style "separator_menu_item" {
    xthickness = 1
    ythickness = 1

    GtkSeparatorMenuItem::horizontal-padding = 0
    GtkWidget::wide-separators = 1
    GtkWidget::separator-width = 1
    GtkWidget::separator-height = 7
}

Solution 4

Try using those switches in netbeans.conf

-J-XX:ReservedCodeCacheSize=1024m -J-XX:+UseCodeCacheFlushing

You can give less memory to ReservedCodeCacheSize (default is 64m) but on my system with lots of RAM this switch made Netbeans suddenly much faster.

Solution 5

On Kubuntu 12.04 and I had to reinstall twice in order to get netbeans to load and run. I have experienced major degradation of performance. When I type, it takes seconds for to register.

This is why I've switched to mac at home.

Share:
10,425
oshirowanen
Author by

oshirowanen

Updated on September 18, 2022

Comments

  • oshirowanen
    oshirowanen almost 2 years

    On my 64bit Ubuntu 12.04 on an Intel Core i3 processor which has 16Gb RAM and a M4 SSD, NetBeans is very sluggish as well as the known problem where NetBeans does not use Ubuntu 12.04's global menu. That problem aside, why is NetBeans so slow, it's even slower than Eclipse!

    Please have a look at this video: http://youtu.be/utLQD5Gpg0M

    • RobotHumans
      RobotHumans about 12 years
      I don't think your menu example is an accurate metric for sluggishness. It's waiting for a mouse hover from what I can tell. If you really want to test it for "sluggish" open one of the menus and tap left or right arrow-keys to see how much lag there really is.
    • marcus
      marcus almost 12 years
      I have never seen NetBeans running much faster than that. I think that's just the way it is (I can't imagine what it does in the background to achieve that awful performance...)
  • T0xicCode
    T0xicCode about 12 years
    I have no problem using it with regular ubuntu aside from it not using ubuntu's global appmenu. I'd say it's not that OSO quality has gone to crap but more like "we expect commercial quality of OSO"
  • oshirowanen
    oshirowanen about 12 years
    So what would the solution be here? Netbeans was snappy on 10.04.
  • oshirowanen
    oshirowanen about 12 years
    xav0989, If it wasn't for the quality of OSO in previous releases of Ubuntu where NetBeans worked very responsively, I would have agreed with your comment.
  • Hanynowsky
    Hanynowsky about 12 years
    you're welcome! But what version of Netbeans are u using? What JDK? For me, Netbeans takes some time to load all the modules before starting and then scans all the projects. In total: 15 seconds for Netbeans and 14 s for Eclipse.
  • Hanynowsky
    Hanynowsky about 12 years
    @Jesse a recent study confirmed that open source software code quality has surpassed its rival in proprietary software!
  • oshirowanen
    oshirowanen about 12 years
    I am currently running NetBeans 7.0.1, but I have also tried NetBeans 7.1.2 which doesn't seem to make a difference in terms of speed. I am running java 1.6.0_24: java version "1.6.0_24" OpenJDK Runtime Environment (IcedTea6 1.11.1) (6b24-1.11.1-4ubuntu2) OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode). Also, it takes about 11 seconds in total to load from scratch to becoming usable. Just as a comparison, Libre Calc takes less than a second on my new SSD...
  • Hanynowsky
    Hanynowsky about 12 years
    If you run LibreOffice for the second time, yes it takes less than a second. I have an i7 2.10hz with 4 Go of RAM and netbeans takes 15s to be ready which is pretty normal (netbeans is a huge IDE full of modules).
  • Hanynowsky
    Hanynowsky about 12 years
    Know also that NetBeans is very memory-hungry! Check if OpenJDK has bootstrapping parameters that can be called from netbeans.conf . I would check and if I find something. I'd report to u!
  • Hanynowsky
    Hanynowsky about 12 years
    For the time being. Check this: wiki.netbeans.org/Performance and see if you have SVN enabled. and use some tool to monitor what Netbeans does on its cache (I/O) : ~/.netbeans/7.0/var/cache
  • oshirowanen
    oshirowanen about 12 years
    Just to confirm, starting LibreOffice Calc the first time after switching on the computer takes less than a second to load, it's all down to the SSD. Which is why 11 seconds for NetBeans is shocking. i.e. it takes 11 times longer to load. Thanks for the info and links, I'll have a look at them now.
  • Jesse
    Jesse about 12 years
    @Hanynowsky That is true however I prefer a system where both hardware and software are taken into consideration when being developed. i.e. Apple products.
  • Jesse
    Jesse about 12 years
    @xav0989 You have to admit, there are a lot of crappy OSO software out there same with closed source / commercial. Internet exploder as an example. :) ... It all depends on the quality control like anything else. Programmers can be lazy, they don't alpha test or test enough cases. Most never profile and benchmark. Ultimately this reiterates that every software has bugs. As far as Ubuntu's decision w/ Unity and Gnome 3... was a huge mistake. Reason why I abandoned ship as my workstation os. All in all, you get what you pay for.
  • T0xicCode
    T0xicCode almost 12 years
    @oshirowanen I never used netbeans on ubuntu before 11.10, so I don't have anything to compare it to.
  • T0xicCode
    T0xicCode almost 12 years
    @Jesse You are right, I was simply considering good commercial programs in my analogy.
  • onse
    onse almost 12 years
    There actually is some Java Swing global menu integration. It's called Java Ayatana (hanynowsky.wordpress.com/2012/05/12/…) and runs with Oracle's Java and the open JDK 7 (but not 6) if I am not mistaking. This also works for Netbeans of course.