netbeans installation error: can't initialize ui running in headless mode

15,081

Solution 1

Looks like Netbeans does not work properly with Openjdk. This is what I did (in Linux Mint 12):

sudo apt-get remove openjdk*
sudo apt-get install sun-java6-jdk

Then you will be able to run the .sh installer as usual.

Solution 2

In case anyone has this problem in the future, Netbeans doesn't like OpenJDK 6 but -- fortunately -- it works fine with OpenJDK 7 (as expected as for Java 7 OpenJDK is the reference implementation). Just make sure you remove any Java 6 packages before installation attempts. On Ubuntu and Mint one can do:

sudo apt-get purge ^openjdk-6-*
sudo apt-get install openjdk-7-jdk

It should work afterwards.

Solution 3

I hit this same issue on Kubuntu 12.04 LTS but needed Sun JDK 6 for a project I'm maintaining. I stumbled upon Martin Wimpress' OAB-Java script (by way of help.ubuntu.com) which creates and installs a local apt repository for Sun JDK 6. You can find the latest instructions on Martin's github site which run as follows:

cd ~/
wget https://github.com/flexiondotorg/oab-java6/raw/0.2.7/oab-java.sh \
-O oab-java.sh
chmod +x oab-java.sh
sudo ./oab-java.sh

If you want to see what this script is doing while it is running then execute the following from another shell:

tail -f ./oab-java.sh.log

Alternatively, you can clone the OAB-Java repo and kick of the script from within it:

git clone git://github.com/flexiondotorg/oab-java6.git
cd oab-java6
sudo ./oab-java.sh

Either way, once that is in place follow Jose's instructions to remove openjdk and install sun jdk:

sudo apt-get remove openjdk*
sudo apt-get install sun-java6-jdk


One final note, the script accepts a -7 argument which will create and install a local apt repository for Oracle JDK 7 should you want to go that route.

Solution 4

I was able to get it to work by getting into the target system using ssh -X, then making sure DISPLAY was exported. That handles the X server issues.

Solution 5

  1. Change the priority of the Oracle Java executables:

    export PATH=/usr/java/latest/bin:$PATH

  2. Run the installer:

    ./netbeans-8.1-linux.sh

Share:
15,081
niravb
Author by

niravb

Love programming and experimenting with different languages and frameworks, interested in webdev and mobile programming.

Updated on July 28, 2022

Comments

  • niravb
    niravb almost 2 years

    I'm trying to install NetBeans on Linux Mint, and I'm getting the following error every time I run the installation script:

    Configuring the installer... Searching for JVM on the system... Extracting installation data... Running the installer wizard... Can`t initialize UI Running in headless mode

    What should I do to get it working?

  • mgol
    mgol about 12 years
    Doesn't work in Ubuntu 12.04 which no longer has the Sun JDK included.
  • MacroMan
    MacroMan almost 11 years
    I had to sudo apt-get remove openjdk* first, but other than that, works a treat.
  • Eric Fossum
    Eric Fossum about 9 years
  • Thufir
    Thufir over 7 years
    and so you're able to run NB remotely, just viewing it, basically, through X server?