18

After fresh Ubuntu 18.04 installation and afterwards a netbeans installation, netbeans does not start. netbeans was installed with

sudo apt install netbeans

some other java programms (at least Eclipse) do not start too.

when starting netbeans from commandline the JVM prints folowing WARNINGS:

➜  ~ netbeans
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.netbeans.ProxyURLStreamHandlerFactory (file:/usr/share/netbeans/platform18/lib/boot.jar) to field java.net.URL.handler
WARNING: Please consider reporting this to the maintainers of org.netbeans.ProxyURLStreamHandlerFactory
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
➜  ~ 
11

Ubuntu's repository still has Netbeans 8.1 but JDK 11. So I've downloaded Netbeans 8.2 from Netbeans Website

After downloading Netbeans 8.2, follow these steps:

sudo apt autoremove netbeans
cd Downloads
sudo chmod +x netbeans-8.2-linux.sh
./netbeans-8.2-linux.sh

and follow on screen instructions. Import settings and launch the netbeans from app drawer.

Also if you have any package with name as JDK 8, just remove it. You can find the packages installed by using

sudo apt list --installed

and remove all packages with name as openjdk-8- by using,

sudo apt autoremove <package_name>

For Installation of Netbeans 9.0 see here.

  • 1
    So I think the current version of java on 18.04 should not be marked as "stable". Eclipse does not work too. – neoexpert May 4 '18 at 18:18
  • 5
    Netbeans seems to be quite broken currently under 18.04. I have tried several jdk versions(open and oracle) as well as the default package and the netbeans installer. The Windows or Mac comment is not pertinent as this issue is related to the state of 18.04. Everything works fine on previous releases. – Captain Giraffe May 7 '18 at 12:12
4

I was able to get it working by installing and setting JDK8 as default.

I followed the instructions on this website: https://linuxconfig.org/how-to-install-java-on-ubuntu-18-04-bionic-beaver-linux

specifically:

Adding the PPA repository:

sudo add-apt-repository ppa:webupd8team/java
sudo apt update

Install Java 8, and set as default:

sudo apt install oracle-java8-set-default

I was able to install using the netbeans .sh file installed after that

  • this worked for me, should be the accepted answer. – Adriaan Nel Dec 9 '18 at 20:58
3

I was able to solve this by running sudo update-alternatives --config java and then selecting the java-8 option rather than the default java-11. You will need to have the java-8 openjdk package still installed for this to work though.

3

Same problem with me as well after upgrading to Ubuntu 18.04. Netbeans stopped working. I tried many ways changing the configuration. The primary reason for this problem is java dependency. Netbeans is directly dependent on Oracle Java. Ubuntu 18.04 comes with default open jdk11 installed and set as default java. When Netbeans starts it checks for the dependencies and fails due to this. Though in few cases it opens but not all the features working. Sometime only few windows only working. Specially project explorer doesn't work.

To see the errors you can check the log file from the menu->view->IDELog

System Info: 
  Product Version         = NetBeans IDE 8.2 (Build 201609300101) (#5fd841261bf9)
  Operating System        = Linux version 4.15.0-34-generic running on amd64
  Java; VM; Vendor        = 1.8.0_181; Java HotSpot(TM) 64-Bit Server VM 25.181-b13; Oracle Corporation
  Runtime                 = Java(TM) SE Runtime Environment 1.8.0_181-b13
  Java Home               = /usr/lib/jvm/java-8-oracle/jre
  System Locale; Encoding = en_IN (nb); UTF-8
  Home Directory          = /home/mukesh
  Current Directory       = /home/mukesh
  User Directory          = /home/mukesh/.netbeans/8.2
  Cache Directory         = /home/mukesh/.cache/netbeans/8.2
  Installation            = /home/mukesh/netbeans-8.2/...

------------------------------------------------------------------------------

Finally what worked for me is.

Finally what worked for me is setting the java_home path in the installed directory of Netbeans. Netbeans 8.2 is installed in HOME directory in general. Sometime it can be different. You can find out using locate command. change path for java_home inside

/home/<Netbean DIR>/etc/netbeans.conf
netbeans_jdkhome="/usr/lib/jvm/java-8-oracle"

Restart the Netbeans and it will work all well.

NOTE: Changing the above in system /etc/netbeans.conf directory will not work.

  • Did you use the Netbeans from Ubuntu repository or downloaded from Netbeans website and installed by script? – Youda008 Dec 4 '18 at 20:33
  • From Netbeans website and installed with script. – Mukesh Singh Rathaur Dec 5 '18 at 4:17
2

Remove Java 11 (which is not compatible with Netbeans 8.2 on Ubuntu 18.xx):

sudo apt remove netbeans
sudo apt remove openjdk-11-*

Install Java 8 and Netbeans 8.2 (Netbeans is about 214MB):

sudo apt install openjdk-8-jdk

wget https://download.netbeans.org/netbeans/8.2/final/bundles/netbeans-8.2-linux.sh

sudo sh netbeans-8.2-linux.sh

When it asks about Java Location select /usr/lib/jvm/java-8-openjdk-amd64.

After installation you can access it via

/usr/local/netbeans-8.2/bin/netbeans

if you chose default location.

1

What solved the problem for me was two things:

  1. Setting the jdk to Oracle Java 8 (if installed you can choose it while installing netbeans)
  2. Installing netbeans 8.2 instead of the default on Ubuntu which, for me, was 8.1
1

I have the same problem ,though i resolved it! Actual problem which jdk version is used by Netbeans.As in the bionic beaver comes with new jdk version ,while old cofiguration of the Netbeans use the old one ,first uninstall existing netbeans and then download netbeans from the website the during installation ,seletct jdk8 as option . It worked for me , may work for you !

I am learner, your suggestion are always welcome!

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.