1

I'm trying to install Netbeans on my Ubuntu. It was successfully installed but was unable to create new projects or new files. I have installed JDK 12 and then I removed it because I found here a solution that recommended removal of latest versions of JDK and set JDK 8 as default. I did what solution said but now I can't install JDK 8. It is showing me this error message:

E: Package 'oracle-java8-installer' has no installation candidate 

So I started searching on the Internet about the solution and I found that "Oracle Java (JDK) 8 Installer PPA (DISCONTINUED)".

What should I do now?

ThunderBird
  • 1,955

1 Answers1

1

Open the terminal and type:

sudo apt install openjdk-8-jdk openjdk-11-jdk

Open NetBeans and check in Tools -> Options -> Java -> Nashorn tab that the default Java after where it says Java Platform is the same as the Java version which you want to use in your project.

select Java Platform
Apache NetBeans IDE 11.0 snap package

You can add a new Java platform to the Java Platform dropdown menu by clicking the Manage Platform button to the right of the Java Platform dropdown menu.

The apt package version of NetBeans in 18.04 is 10.0-3 and the snap package version of NetBeans in all currently supported versions of Ubuntu is 11.0. The version of NetBeans is the same as the Java version it targets, so NetBeans 11 targets Java 11 and NetBeans 12 targets Java 12, etc. Although JDK 8 is no longer maintained by Oracle, the openjdk-8-jdk package is still maintained in Ubuntu 16.04-21.10.

If you tried to run a higher Java version in NetBeans than the NetBeans version, for example Java 14 in NetBeans 12, it would probably run, but there could be unexpected glitches with some of the plugins.

karel
  • 114,770
  • but its not opening like nothing. I clicked on Icon and nothing happen. – Hamza Yousaf May 15 '19 at 13:40
  • Maybe you have typed the Java path incorrectly, so NetBeans is unable to identify any Java platform, so you can't open a new project with File -> New Project. The paths are /usr/lib/jvm/java-8-openjdk-amd64 and /usr/lib/jvm/java-11-openjdk-amd64 – karel May 15 '19 at 13:43
  • @Kulfy This OP wants an old version of NetBeans and an unsupported version of JDK 8. I'm trying to answer this question so that the OP can use NetBeans, even if he has to install the latest versions of software in order to do it. Otherwise there will be an X-Y problem. – karel May 15 '19 at 13:58
  • @Kulfy That's exactly what I already did. How to install the newer versions is already included in the above answer. – karel May 15 '19 at 14:01