Gradle 5 & Java 11 build error: Why does Gradle think I'm using Java 10?
I'm unable to build my project using Java 11 and Gradle 5. I receive the following error trying to build:
$ gradle clean build
> Task :compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Could not target platform: 'Java SE 11' using tool chain: 'JDK 10 (1.10)'.
Why does Gradle think I'm using JDK 10? My $JAVA_HOME
is set to /usr/lib/jvm/java-1.11.0-openjdk-amd64/
, which is the Linux OpenJDK build for Java 11 (found here https://jdk.java.net/11/). I'm using Gradle 5, but this error also occurred using 4.10.2.
Below are the relevant parts of my build.gradle
:
apply plugin: 'java'
sourceCompatibility = 11
I've also tried using 1.11
for source compatibility but this also fails with the same error.
java ubuntu gradle
add a comment |
I'm unable to build my project using Java 11 and Gradle 5. I receive the following error trying to build:
$ gradle clean build
> Task :compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Could not target platform: 'Java SE 11' using tool chain: 'JDK 10 (1.10)'.
Why does Gradle think I'm using JDK 10? My $JAVA_HOME
is set to /usr/lib/jvm/java-1.11.0-openjdk-amd64/
, which is the Linux OpenJDK build for Java 11 (found here https://jdk.java.net/11/). I'm using Gradle 5, but this error also occurred using 4.10.2.
Below are the relevant parts of my build.gradle
:
apply plugin: 'java'
sourceCompatibility = 11
I've also tried using 1.11
for source compatibility but this also fails with the same error.
java ubuntu gradle
Not sure that Gradle supports Java 11 yet. Others have seen this error.
– Peter Lawrey
Nov 26 '18 at 23:36
Their Gradle 5 release notes say they officially support Java 11 now: github.com/gradle/gradle/releases/tag/v5.0.0
– heez
Nov 26 '18 at 23:38
Did some more digging, the problem I'm experiencing is unique to Ubuntu. Ubuntu actually provides JDK10 disguised as JDK11, no clue why: bugs.launchpad.net/ubuntu/+source/openjdk-lts/+bug/1796027 Not sure why anyone would think that's a good idea.
– heez
Nov 26 '18 at 23:40
See also askubuntu.com/questions/1037646/…
– heez
Nov 26 '18 at 23:42
add a comment |
I'm unable to build my project using Java 11 and Gradle 5. I receive the following error trying to build:
$ gradle clean build
> Task :compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Could not target platform: 'Java SE 11' using tool chain: 'JDK 10 (1.10)'.
Why does Gradle think I'm using JDK 10? My $JAVA_HOME
is set to /usr/lib/jvm/java-1.11.0-openjdk-amd64/
, which is the Linux OpenJDK build for Java 11 (found here https://jdk.java.net/11/). I'm using Gradle 5, but this error also occurred using 4.10.2.
Below are the relevant parts of my build.gradle
:
apply plugin: 'java'
sourceCompatibility = 11
I've also tried using 1.11
for source compatibility but this also fails with the same error.
java ubuntu gradle
I'm unable to build my project using Java 11 and Gradle 5. I receive the following error trying to build:
$ gradle clean build
> Task :compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Could not target platform: 'Java SE 11' using tool chain: 'JDK 10 (1.10)'.
Why does Gradle think I'm using JDK 10? My $JAVA_HOME
is set to /usr/lib/jvm/java-1.11.0-openjdk-amd64/
, which is the Linux OpenJDK build for Java 11 (found here https://jdk.java.net/11/). I'm using Gradle 5, but this error also occurred using 4.10.2.
Below are the relevant parts of my build.gradle
:
apply plugin: 'java'
sourceCompatibility = 11
I've also tried using 1.11
for source compatibility but this also fails with the same error.
java ubuntu gradle
java ubuntu gradle
edited Nov 27 '18 at 17:17
heez
asked Nov 26 '18 at 22:38
heezheez
7772920
7772920
Not sure that Gradle supports Java 11 yet. Others have seen this error.
– Peter Lawrey
Nov 26 '18 at 23:36
Their Gradle 5 release notes say they officially support Java 11 now: github.com/gradle/gradle/releases/tag/v5.0.0
– heez
Nov 26 '18 at 23:38
Did some more digging, the problem I'm experiencing is unique to Ubuntu. Ubuntu actually provides JDK10 disguised as JDK11, no clue why: bugs.launchpad.net/ubuntu/+source/openjdk-lts/+bug/1796027 Not sure why anyone would think that's a good idea.
– heez
Nov 26 '18 at 23:40
See also askubuntu.com/questions/1037646/…
– heez
Nov 26 '18 at 23:42
add a comment |
Not sure that Gradle supports Java 11 yet. Others have seen this error.
– Peter Lawrey
Nov 26 '18 at 23:36
Their Gradle 5 release notes say they officially support Java 11 now: github.com/gradle/gradle/releases/tag/v5.0.0
– heez
Nov 26 '18 at 23:38
Did some more digging, the problem I'm experiencing is unique to Ubuntu. Ubuntu actually provides JDK10 disguised as JDK11, no clue why: bugs.launchpad.net/ubuntu/+source/openjdk-lts/+bug/1796027 Not sure why anyone would think that's a good idea.
– heez
Nov 26 '18 at 23:40
See also askubuntu.com/questions/1037646/…
– heez
Nov 26 '18 at 23:42
Not sure that Gradle supports Java 11 yet. Others have seen this error.
– Peter Lawrey
Nov 26 '18 at 23:36
Not sure that Gradle supports Java 11 yet. Others have seen this error.
– Peter Lawrey
Nov 26 '18 at 23:36
Their Gradle 5 release notes say they officially support Java 11 now: github.com/gradle/gradle/releases/tag/v5.0.0
– heez
Nov 26 '18 at 23:38
Their Gradle 5 release notes say they officially support Java 11 now: github.com/gradle/gradle/releases/tag/v5.0.0
– heez
Nov 26 '18 at 23:38
Did some more digging, the problem I'm experiencing is unique to Ubuntu. Ubuntu actually provides JDK10 disguised as JDK11, no clue why: bugs.launchpad.net/ubuntu/+source/openjdk-lts/+bug/1796027 Not sure why anyone would think that's a good idea.
– heez
Nov 26 '18 at 23:40
Did some more digging, the problem I'm experiencing is unique to Ubuntu. Ubuntu actually provides JDK10 disguised as JDK11, no clue why: bugs.launchpad.net/ubuntu/+source/openjdk-lts/+bug/1796027 Not sure why anyone would think that's a good idea.
– heez
Nov 26 '18 at 23:40
See also askubuntu.com/questions/1037646/…
– heez
Nov 26 '18 at 23:42
See also askubuntu.com/questions/1037646/…
– heez
Nov 26 '18 at 23:42
add a comment |
1 Answer
1
active
oldest
votes
The issue was unique to Ubuntu 18. The "JDK11" that is in apt
is actually JDK10 with backported JDK11 security updates. That's fairly confusing, so there is an open bug report with Ubuntu. See also this post on the AskUbuntu stack exchange.
To resolve the issue you have to manually set your system to use an actual JDK11. I did something similar to this guide to fix it.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53490183%2fgradle-5-java-11-build-error-why-does-gradle-think-im-using-java-10%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The issue was unique to Ubuntu 18. The "JDK11" that is in apt
is actually JDK10 with backported JDK11 security updates. That's fairly confusing, so there is an open bug report with Ubuntu. See also this post on the AskUbuntu stack exchange.
To resolve the issue you have to manually set your system to use an actual JDK11. I did something similar to this guide to fix it.
add a comment |
The issue was unique to Ubuntu 18. The "JDK11" that is in apt
is actually JDK10 with backported JDK11 security updates. That's fairly confusing, so there is an open bug report with Ubuntu. See also this post on the AskUbuntu stack exchange.
To resolve the issue you have to manually set your system to use an actual JDK11. I did something similar to this guide to fix it.
add a comment |
The issue was unique to Ubuntu 18. The "JDK11" that is in apt
is actually JDK10 with backported JDK11 security updates. That's fairly confusing, so there is an open bug report with Ubuntu. See also this post on the AskUbuntu stack exchange.
To resolve the issue you have to manually set your system to use an actual JDK11. I did something similar to this guide to fix it.
The issue was unique to Ubuntu 18. The "JDK11" that is in apt
is actually JDK10 with backported JDK11 security updates. That's fairly confusing, so there is an open bug report with Ubuntu. See also this post on the AskUbuntu stack exchange.
To resolve the issue you have to manually set your system to use an actual JDK11. I did something similar to this guide to fix it.
answered Nov 27 '18 at 17:16
heezheez
7772920
7772920
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53490183%2fgradle-5-java-11-build-error-why-does-gradle-think-im-using-java-10%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Not sure that Gradle supports Java 11 yet. Others have seen this error.
– Peter Lawrey
Nov 26 '18 at 23:36
Their Gradle 5 release notes say they officially support Java 11 now: github.com/gradle/gradle/releases/tag/v5.0.0
– heez
Nov 26 '18 at 23:38
Did some more digging, the problem I'm experiencing is unique to Ubuntu. Ubuntu actually provides JDK10 disguised as JDK11, no clue why: bugs.launchpad.net/ubuntu/+source/openjdk-lts/+bug/1796027 Not sure why anyone would think that's a good idea.
– heez
Nov 26 '18 at 23:40
See also askubuntu.com/questions/1037646/…
– heez
Nov 26 '18 at 23:42