Ubuntu – NetBeans doesn’t work

18.04javanetbeans

I never used Ubuntu in my life before, and now I've installed Ubuntu 18.04 lts. I have problem with NetBeans. Although I have JDK and the rest that needs, I get this:

]

I can't open or start a project,nothing happens when I click. What should I do to fix this?

Best Answer

Installing Netbeans 9.0:

  • Building from Source:

    1. Download the source zip from here and extract. Or open terminal and clone the repositories from GitHub using

      git clone https://github.com/apache/incubator-netbeans
      
    2. Install either Oracle JDK or OpenJDK.

      • For Oracle JDK: Download JDK8 from here and run these commands:

        sudo su
        mkdir /opt/jdk
        tar -zxf jdk-8u181-linux-x64.tar.gz -C /opt/jdk
        update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_181/bin/java 100
        update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_181/bin/java 100
        
      • For OpenJDK, run

        sudo apt install openjdk-8-jdk
        sudo apt install openjdk-8-jre
        
    3. Install Apache ANT: For installing Apache Ant v1.10.3, run

      sudo apt install ant
      
    4. Once you’re all set just enter the incubator-netbeans directory and type ant to build the Apache NetBeans IDE.

    5. Once built, the IDE bits are placed in the ./nbbuild/netbeans directory. You can run the IDE from within the incubator-netbeans directory by typing ./nbbuild/netbeans/bin/netbeans or use ant tryme to run the Apache NetBeans IDE.

  • Installing from Binaries: Download the binary zip from here. Unpack the zip and run netbeans in bin folder using ./netbeans. I'll suggest to make a desktop entry a.k.a. menu shortcut. For details about it read this and this.

For natively installing Netbeans v8.2, See Karel's answer.

Original Answer:

Java seems to be quite broken currently under 18.04. This can create problems with Netbeans as well as Eclipse. So, I'll suggest not to install Java from Ubuntu's repository.

If you want JDK as well as Netbeans first of all remove Java completely from your system. Then download NB+JDK from here.

I assume that downloaded files go to Downloads and downloaded file name is jdk-8u111-nb-8_2-linux-x64.sh. Use below commands to install Netbeans and JDK 1.8.

  • Navigate to the folder(Downloads) containing file using

    cd ~/Downloads
    
  • Make file executable(if already not) using

    chmod +x jdk-8u111-nb-8_2-linux-x64.sh
    
  • Finally run it using

    ./jdk-8u111-nb-8_2-linux-x64.sh
    
  • Follow on screen instructions to complete installation.

Related Question