JDK11 package does not exist
Answered
Hello,
I have been trying to transition to JDK 11 in order to use the java.net.http package, but every time I try to build I get 'Error: java: package java.net.http does not exist'.
The package is present in the external libraries and recognized by the autocompletion, I use Gradle 4.10.2 and IDEA 2018.2.4.
Any help would be very appreciated.
Kindly.
Please sign in to leave a comment.
Please check this sample project using JDK 11 http: http11.zip.
It works without errors in IntelliJ IDEA 2018.2.4:
Compare to your project configuration to find out what's wrong.
This sample project is from the discussion at https://stackoverflow.com/a/52342080/104891.
The common problem is when the project/module language level is not set to 11:
It kind of worked, packages like java.net.http are now recognized, but others aren't anymore ! For instance the class JSONObject is not recognized, and I can't import it.
After research, it seems that the json packages are not available under Java SE.
Weird that I now have to add a dependency.