Eclipse on Mac uses wrong JDK





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I've got two JDKs on my Mac, 1.8 and OpenJDK 11. I have this line in my .profile:



export JAVA_HOME=$(/usr/libexec/java_home -v 11)


In a terminal, java -version shows it's using 11, and echo $JAVA_HOME also points to 11.



I have set Preferences/Java/Installed JREs to 11. I have set the compliance level to 11 in the compiler config in my pom.



Eclipse, however, shows the "JRE System Library" in my project to be 1.8. When I execute a class in the project, it runs under 1.8.



What gives? Is there a secret setting on the Mac telling Eclipse to use 1.8? Or a secret setting in the Eclipse config?



(I'm using the latest version of Eclipse, 2018-09, fully up-to-date.)



Update: Per @vshcherbinin's comment, the Run Configuration/Java Application/JRE tab says "Project execution environment 'JavaSE-1.8' (Home)". I do not believe I have any project-specific settings. I deleted the .project, .classpath, and .settings in the project and re-imported the basic Maven project. Not sure how to make the project execution environment default to 11.










share|improve this question

























  • Have you looked into your Run Configuration? Check "Run Configuration" -> "Java Application" -> JRE tab.

    – vs97
    Nov 23 '18 at 21:28











  • @vshcherbinin see update

    – ccleve
    Nov 23 '18 at 21:35











  • In the same "JRE" tab there is "Alternate JRE" field, you can set the JRE you want there.

    – vs97
    Nov 23 '18 at 21:37











  • @vshcherbinin Ok, that's helpful, and it does work for that one class. But it doesn't change the JRE System Library. I'd like to change the default globally.

    – ccleve
    Nov 23 '18 at 21:40











  • I think you can edit your eclipse.ini to set an specific jvm to use, add the following lines before the -vmargs -vm /Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home/lib/jli/libjli.dylib In my case I only have java 10, but it should be the same for the 11 one I think, -vm and the path should be on different lines.

    – nmorenor
    Nov 23 '18 at 22:29




















0















I've got two JDKs on my Mac, 1.8 and OpenJDK 11. I have this line in my .profile:



export JAVA_HOME=$(/usr/libexec/java_home -v 11)


In a terminal, java -version shows it's using 11, and echo $JAVA_HOME also points to 11.



I have set Preferences/Java/Installed JREs to 11. I have set the compliance level to 11 in the compiler config in my pom.



Eclipse, however, shows the "JRE System Library" in my project to be 1.8. When I execute a class in the project, it runs under 1.8.



What gives? Is there a secret setting on the Mac telling Eclipse to use 1.8? Or a secret setting in the Eclipse config?



(I'm using the latest version of Eclipse, 2018-09, fully up-to-date.)



Update: Per @vshcherbinin's comment, the Run Configuration/Java Application/JRE tab says "Project execution environment 'JavaSE-1.8' (Home)". I do not believe I have any project-specific settings. I deleted the .project, .classpath, and .settings in the project and re-imported the basic Maven project. Not sure how to make the project execution environment default to 11.










share|improve this question

























  • Have you looked into your Run Configuration? Check "Run Configuration" -> "Java Application" -> JRE tab.

    – vs97
    Nov 23 '18 at 21:28











  • @vshcherbinin see update

    – ccleve
    Nov 23 '18 at 21:35











  • In the same "JRE" tab there is "Alternate JRE" field, you can set the JRE you want there.

    – vs97
    Nov 23 '18 at 21:37











  • @vshcherbinin Ok, that's helpful, and it does work for that one class. But it doesn't change the JRE System Library. I'd like to change the default globally.

    – ccleve
    Nov 23 '18 at 21:40











  • I think you can edit your eclipse.ini to set an specific jvm to use, add the following lines before the -vmargs -vm /Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home/lib/jli/libjli.dylib In my case I only have java 10, but it should be the same for the 11 one I think, -vm and the path should be on different lines.

    – nmorenor
    Nov 23 '18 at 22:29
















0












0








0








I've got two JDKs on my Mac, 1.8 and OpenJDK 11. I have this line in my .profile:



export JAVA_HOME=$(/usr/libexec/java_home -v 11)


In a terminal, java -version shows it's using 11, and echo $JAVA_HOME also points to 11.



I have set Preferences/Java/Installed JREs to 11. I have set the compliance level to 11 in the compiler config in my pom.



Eclipse, however, shows the "JRE System Library" in my project to be 1.8. When I execute a class in the project, it runs under 1.8.



What gives? Is there a secret setting on the Mac telling Eclipse to use 1.8? Or a secret setting in the Eclipse config?



(I'm using the latest version of Eclipse, 2018-09, fully up-to-date.)



Update: Per @vshcherbinin's comment, the Run Configuration/Java Application/JRE tab says "Project execution environment 'JavaSE-1.8' (Home)". I do not believe I have any project-specific settings. I deleted the .project, .classpath, and .settings in the project and re-imported the basic Maven project. Not sure how to make the project execution environment default to 11.










share|improve this question
















I've got two JDKs on my Mac, 1.8 and OpenJDK 11. I have this line in my .profile:



export JAVA_HOME=$(/usr/libexec/java_home -v 11)


In a terminal, java -version shows it's using 11, and echo $JAVA_HOME also points to 11.



I have set Preferences/Java/Installed JREs to 11. I have set the compliance level to 11 in the compiler config in my pom.



Eclipse, however, shows the "JRE System Library" in my project to be 1.8. When I execute a class in the project, it runs under 1.8.



What gives? Is there a secret setting on the Mac telling Eclipse to use 1.8? Or a secret setting in the Eclipse config?



(I'm using the latest version of Eclipse, 2018-09, fully up-to-date.)



Update: Per @vshcherbinin's comment, the Run Configuration/Java Application/JRE tab says "Project execution environment 'JavaSE-1.8' (Home)". I do not believe I have any project-specific settings. I deleted the .project, .classpath, and .settings in the project and re-imported the basic Maven project. Not sure how to make the project execution environment default to 11.







java eclipse macos






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 '18 at 21:34







ccleve

















asked Nov 23 '18 at 21:03









ccleveccleve

7,1491561111




7,1491561111













  • Have you looked into your Run Configuration? Check "Run Configuration" -> "Java Application" -> JRE tab.

    – vs97
    Nov 23 '18 at 21:28











  • @vshcherbinin see update

    – ccleve
    Nov 23 '18 at 21:35











  • In the same "JRE" tab there is "Alternate JRE" field, you can set the JRE you want there.

    – vs97
    Nov 23 '18 at 21:37











  • @vshcherbinin Ok, that's helpful, and it does work for that one class. But it doesn't change the JRE System Library. I'd like to change the default globally.

    – ccleve
    Nov 23 '18 at 21:40











  • I think you can edit your eclipse.ini to set an specific jvm to use, add the following lines before the -vmargs -vm /Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home/lib/jli/libjli.dylib In my case I only have java 10, but it should be the same for the 11 one I think, -vm and the path should be on different lines.

    – nmorenor
    Nov 23 '18 at 22:29





















  • Have you looked into your Run Configuration? Check "Run Configuration" -> "Java Application" -> JRE tab.

    – vs97
    Nov 23 '18 at 21:28











  • @vshcherbinin see update

    – ccleve
    Nov 23 '18 at 21:35











  • In the same "JRE" tab there is "Alternate JRE" field, you can set the JRE you want there.

    – vs97
    Nov 23 '18 at 21:37











  • @vshcherbinin Ok, that's helpful, and it does work for that one class. But it doesn't change the JRE System Library. I'd like to change the default globally.

    – ccleve
    Nov 23 '18 at 21:40











  • I think you can edit your eclipse.ini to set an specific jvm to use, add the following lines before the -vmargs -vm /Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home/lib/jli/libjli.dylib In my case I only have java 10, but it should be the same for the 11 one I think, -vm and the path should be on different lines.

    – nmorenor
    Nov 23 '18 at 22:29



















Have you looked into your Run Configuration? Check "Run Configuration" -> "Java Application" -> JRE tab.

– vs97
Nov 23 '18 at 21:28





Have you looked into your Run Configuration? Check "Run Configuration" -> "Java Application" -> JRE tab.

– vs97
Nov 23 '18 at 21:28













@vshcherbinin see update

– ccleve
Nov 23 '18 at 21:35





@vshcherbinin see update

– ccleve
Nov 23 '18 at 21:35













In the same "JRE" tab there is "Alternate JRE" field, you can set the JRE you want there.

– vs97
Nov 23 '18 at 21:37





In the same "JRE" tab there is "Alternate JRE" field, you can set the JRE you want there.

– vs97
Nov 23 '18 at 21:37













@vshcherbinin Ok, that's helpful, and it does work for that one class. But it doesn't change the JRE System Library. I'd like to change the default globally.

– ccleve
Nov 23 '18 at 21:40





@vshcherbinin Ok, that's helpful, and it does work for that one class. But it doesn't change the JRE System Library. I'd like to change the default globally.

– ccleve
Nov 23 '18 at 21:40













I think you can edit your eclipse.ini to set an specific jvm to use, add the following lines before the -vmargs -vm /Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home/lib/jli/libjli.dylib In my case I only have java 10, but it should be the same for the 11 one I think, -vm and the path should be on different lines.

– nmorenor
Nov 23 '18 at 22:29







I think you can edit your eclipse.ini to set an specific jvm to use, add the following lines before the -vmargs -vm /Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home/lib/jli/libjli.dylib In my case I only have java 10, but it should be the same for the 11 one I think, -vm and the path should be on different lines.

– nmorenor
Nov 23 '18 at 22:29














0






active

oldest

votes












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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53452922%2feclipse-on-mac-uses-wrong-jdk%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53452922%2feclipse-on-mac-uses-wrong-jdk%23new-answer', 'question_page');
}
);

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







這個網誌中的熱門文章

Xamarin.form Move up view when keyboard appear

Post-Redirect-Get with Spring WebFlux and Thymeleaf

Anylogic : not able to use stopDelay()