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?

  • Which Netbeans version have you installed and how? Netbeans are also compatible with OpenJDK. You can install OpenJDK8 using sudo apt install openjdk-8-jdk openjdk-8-jre. – Kulfy May 15 at 13:07
  • My Netbeans Version is IDE 8.2 . Ok let me try your method ;) – Hamza Yousaf May 15 at 13:29
  • Netbeans 8.2 is compatible with JDK8 only. If you want to use JDK 11 or 12, you need to install Netbeans 10 or 11 which is described here. – Kulfy May 15 at 13:31
  • Thanks :) OpenJDK8 has successfully installed but new problem comes up :( My netbeans is not opening. – Hamza Yousaf May 15 at 13:35
  • How did you install Netbeans? – Kulfy May 15 at 13:35

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. Although JDK 8 is no longer maintained by Oracle, it is still maintained in Ubuntu 16.04-19.04.

  • but its not opening like nothing. I clicked on Icon and nothing happen. – Hamza Yousaf May 15 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 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 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 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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