Ubuntu – Java version problem with Eclipse and NetBeans on 18.04

18.04eclipsejavanetbeans

I'm new to Ubuntu, using 18.04 and trying to install Netbeans or Eclipse but neither of them works.

At first my java was version 10. Searching for solutions I found many suggestions to install version 8 so I installed that and changed my default java to 8, but I'm getting new errors.

Here is the error of eclipse which is in its configuration folder (after running eclipse from terminal, eclipse guided me there to see the error):

!SESSION Sat Jun 09 15:21:19 CEST 2018 -----------------------------------------
!ENTRY org.eclipse.equinox.launcher 4 0 2018-06-09 15:21:19.382
!MESSAGE Exception launching the Eclipse Platform:
!STACK
java.lang.ClassNotFoundException: org.eclipse.core.runtime.adaptor.EclipseStarter
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:626)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1414)

Netbeans doesn't even give error messages – it just can't load.

Again I searched to see what is wrong it seems these applications even need older versions of java but I can't find any older version. (java doesn't support them)

Can someone please help?

Best Answer

The current version of NetBeans from the default Ubuntu repositories is 10.0 in Ubuntu 18.04 and later. NetBeans 10 is compatible with either openjdk-8-jdk or openjdk-11-jdk in 18.04. To install it open the terminal and type:

sudo apt install openjdk-8-jdk netbeans  

or

sudo apt install openjdk-11-jdk netbeans 

The eclipse snap package works well with Java in Ubuntu 18.04 too.

sudo snap install eclipse --classic
Related Question