1

This problem is right at the edge of askubuntu and stackoverflow, so if you think it should move, I would appreciate help in moving it.

On ubuntu, Netbeans 10 is not working. On windows, the same version of netbeans works. On both platforms, the code will not compile with jdk11, but at least can use jdk8 on windows.

I installed netbeans under ubuntu 19:

sudo apt install netbeans

Here is what netbeans about shows:

Product Version: Apache NetBeans IDE 10.0 (Build 20190125-debian-10.0)
Java: 11.0.4; OpenJDK 64-Bit Server VM 11.0.4+11-post-Ubuntu-1ubuntu219.04
Runtime: OpenJDK Runtime Environment 11.0.4+11-post-Ubuntu-1ubuntu219.04
System: Linux version 5.0.0-23-generic running on amd64; UTF-8; en_US (nb)
User directory: /home/user/.netbeans/10.0
Cache directory: /home/user/.cache/netbeans/10.0

Netbeans will not build using jdk11. I downloaded jdk-8u221-linux-x64.tar.gz

and installed to /opt/jdk1.8.0_221

then if the project library is to set jdk1.8: enter image description here

the code compiles, but still does not run. Under the run tab, it says it is using "project default" and when I click, it is always using the original system jdk11. I can select jdk1.8, but when I close that requester it never uses it.

To verify, I compile on the command line.

javac *.java

AssignmentList.java:1: error: package com.sun.javafx.collections does 
not exist
import com.sun.javafx.collections.ListListenerHelper;

An empty program with a blank main does work, jdk11 merely does not work with swing, not sure what other libraries.

If I compile manually using jdk1.8, it works.

/opt/jdk1.8.0_221/bin/javac *.java
/opt/jdk1.8.0_221/bin/java WhateverProgram

How do I get netbeans to compile java under Ubuntu, and what is wrong with JDK11?

1 Answer 1

0

I am having the same issue with JDK 11, so I can't help too much with that, but I did figure out how to fix the issue with JDK 8. Go into Project Properties > Build > Compiling, and uncheck "Compile on Save".

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .