Fixing Blank Dialog Box in NetBeans

Contributed By; Roger Searjeant

[[{TableOfContentsTitle=TableOfContents} | {TableOfContents title='Table of Contents'}]]

Brief Overview

I've been using LinuxMint 5 for some weeks now, and a very fine distro it is, too. I've noticed that NetBeans 6.1 starts and runs a great deal faster on Mint than on Windows XP - the difference is quite significant. I've been wondering why that is, given that this is Java and therefore presumably only the low-level loaders and file-system interactions differ across platforms. That's just a passing observation and not the point of this post.

Adapted from Blog Entry-

Problem Description

I found one annoying thing happening occasionally (but often enough to be irritating): NetBeans dialog boxes would appear completely empty. Take a look at the screenshot- File:blank-dialogs_NetBeansBlankDialogBoxFix.png There didn't seem to be any pattern to this behaviour; it wasn't always the same dialog, and if you closed the dialog and opened it again it would appear normally. Not good.

Well, it turns out this is known problem when using the Compiz window manager on Linux - a quick search revealed a good post on the NetBeans forums about this subject. The answer is to use the latest JRE / JDK build as it addresses this compatibility issue. I decided to download and install JDK 6u10 RC and give it a try.

Getting Started

To get NetBeans to use the newer JDK, you can do one of two things:

  1. Edit the NetBeans configuration file (in ${installationFolder}/etc/netbeans.conf) and change the path pointed to by netbeans_jdkhome
  2. Change your system default Java installation.
Not very keen on (1) - feels like I'm hiding a workaround in just one application's config, but the problem exists for any Java application I run on this system.

Steps to Reproduce

So I decided to do (2). It worked perfectly, so thought I'd share the steps I used to do it. First, where is Java actually installed on the filesystem? If you do 'which java' in a console, it will report /usr/bin/java.

  • But if you look closely, this is just the first step in an indirection; the ls tool reveals;
$ ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 2008-10-01 06:55 /usr/bin/java -> /etc/alternatives/java
And, /etc/alternatives/java is another step;
$ ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 36 2008-10-01 06:55 /etc/alternatives/java -> /usr/lib/jvm/java-6-sun/jre/bin/java
  • And, the /usr/lib/jvm/java-6-sun file is actually a symbolic link to the actual Java installation folder, which is in the same folder. That's a lot of indirection, and I am quite sure there are good reasons for all of it, but I haven't time to learn all of them.
There is a very detailed post by Anthony Richardson which patiently explains how to create a proper DEB package from the JDK download; this is almost certainly a good idea.
  • I chose to exploit the fact that the last step in the indirection chain is that symbolic link file. By unpacking the JDK directory into /usr/lib/jvm and getting the java-6-sun link to point to the new JDK folder, I decided I could replace 6u6 with 6u10, system-wide.
  • However, there is another file in this folder: the .java-6-sun.jinfo file (this is a '.' file - you'll only be able to see those if you use the a switch with ls (e.g. ls -al) or View/Show Hidden Files in Nautilus). Looking inside it, only the first line appears to contain version-specific stuff - everything below uses paths which use the symbolic link;

jre ControlPanel /usr/lib/jvm/java-6-sun/jre/bin/ControlPanel
jre java /usr/lib/jvm/java-6-sun/jre/bin/java
jre java_vm /usr/lib/jvm/java-6-sun/jre/bin/java_vm
jre javaws /usr/lib/jvm/java-6-sun/jre/bin/javaws
jre jcontrol /usr/lib/jvm/java-6-sun/jre/bin/jcontrol
  • I decided to leave this as-is for now, and edit it later if required. So, in summary here is what I did;
    1. Copied the JDK 6u10 contents into /usr/lib/jvm.
    2. Went to the directory /usr/lib/jvm and opened a gnome-terminal as root (you need to be root or use sudo, to make changes here).
    3. Completely unnecessarily, I backed-up the old symbolic link file, just in case. The easiest way is to use mv (by default mv doesn't follow sym-links), but if you'd prefer to make a copy of a symlink (rather than the object to which it points) you need to use the -P switch, for example;
      cp -P java-6-sun java-6-sun_OLD.
    4. Made a copy of the jinfo file;
      cp .java-6-sun.jinfo .java-6-sun.jinfo_ORIGINAL_1.6.0.06
    5. Made java-6-sun symbolic link point to the new JDK directory:
      ln -s jdk1.6.0_10/ java-6-sun
  • And it does seem to work. NetBeans reports that it's using 6u10, and I haven't seen any empty dialogs yet! Better yet, NetBeans seems to start and run faster, too. (I haven't timed it - this may be placebo effect...)

Any Comments/Suggestions?

Hope this may help out other folk using LinuxMint or Ubuntu, facing the same problem. Of course, remember that you can easily disable Compiz (set Visual Effects to None in the Appearances Preferences), and you can get some simple effects back using Gnome Compositing, available via the Mint Desktop tool in Control Center.

Roger Searjeant

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo