If you already have installed the JDK, verify your JAVA_HOME environment variable is correctly set












2















I face an issue with my application, when compiling it output following message : [ERROR] If you already have installed the JDK, verify your JAVA_HOME environment variable is correctly set.



When i nano ~/.profile i have this line :



export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home


and source $JAVA_HOME outputs :



-bash: source: /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home: is a directory


Someone could helps me how to correctly put java jdk on environnement variable ?



My system :
MacOs High Sierra version 10.13.6










share|improve this question




















  • 4





    JAVA_HOME should be export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/. Although I prefer using SDKMAN! on my mac.

    – Elliott Frisch
    Nov 24 '18 at 20:15











  • Yeah you should just stop at jdk, the further home directory is creating the confusion

    – Yassin Hajaj
    Nov 24 '18 at 20:38











  • Or you can add another line export PATH=${PATH}:$JAVA_HOME/bin to the profile

    – nullpointer
    Nov 25 '18 at 3:19











  • @nullpointer tried but not works

    – ikalangita
    Nov 25 '18 at 19:31











  • Thanks all, @ElliottFrisch, it's not working

    – ikalangita
    Nov 25 '18 at 19:36


















2















I face an issue with my application, when compiling it output following message : [ERROR] If you already have installed the JDK, verify your JAVA_HOME environment variable is correctly set.



When i nano ~/.profile i have this line :



export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home


and source $JAVA_HOME outputs :



-bash: source: /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home: is a directory


Someone could helps me how to correctly put java jdk on environnement variable ?



My system :
MacOs High Sierra version 10.13.6










share|improve this question




















  • 4





    JAVA_HOME should be export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/. Although I prefer using SDKMAN! on my mac.

    – Elliott Frisch
    Nov 24 '18 at 20:15











  • Yeah you should just stop at jdk, the further home directory is creating the confusion

    – Yassin Hajaj
    Nov 24 '18 at 20:38











  • Or you can add another line export PATH=${PATH}:$JAVA_HOME/bin to the profile

    – nullpointer
    Nov 25 '18 at 3:19











  • @nullpointer tried but not works

    – ikalangita
    Nov 25 '18 at 19:31











  • Thanks all, @ElliottFrisch, it's not working

    – ikalangita
    Nov 25 '18 at 19:36
















2












2








2








I face an issue with my application, when compiling it output following message : [ERROR] If you already have installed the JDK, verify your JAVA_HOME environment variable is correctly set.



When i nano ~/.profile i have this line :



export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home


and source $JAVA_HOME outputs :



-bash: source: /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home: is a directory


Someone could helps me how to correctly put java jdk on environnement variable ?



My system :
MacOs High Sierra version 10.13.6










share|improve this question
















I face an issue with my application, when compiling it output following message : [ERROR] If you already have installed the JDK, verify your JAVA_HOME environment variable is correctly set.



When i nano ~/.profile i have this line :



export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home


and source $JAVA_HOME outputs :



-bash: source: /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home: is a directory


Someone could helps me how to correctly put java jdk on environnement variable ?



My system :
MacOs High Sierra version 10.13.6







java macos java-8






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 24 '18 at 20:15









Andrew Tobilko

27.9k104388




27.9k104388










asked Nov 24 '18 at 20:12









ikalangitaikalangita

3511417




3511417








  • 4





    JAVA_HOME should be export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/. Although I prefer using SDKMAN! on my mac.

    – Elliott Frisch
    Nov 24 '18 at 20:15











  • Yeah you should just stop at jdk, the further home directory is creating the confusion

    – Yassin Hajaj
    Nov 24 '18 at 20:38











  • Or you can add another line export PATH=${PATH}:$JAVA_HOME/bin to the profile

    – nullpointer
    Nov 25 '18 at 3:19











  • @nullpointer tried but not works

    – ikalangita
    Nov 25 '18 at 19:31











  • Thanks all, @ElliottFrisch, it's not working

    – ikalangita
    Nov 25 '18 at 19:36
















  • 4





    JAVA_HOME should be export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/. Although I prefer using SDKMAN! on my mac.

    – Elliott Frisch
    Nov 24 '18 at 20:15











  • Yeah you should just stop at jdk, the further home directory is creating the confusion

    – Yassin Hajaj
    Nov 24 '18 at 20:38











  • Or you can add another line export PATH=${PATH}:$JAVA_HOME/bin to the profile

    – nullpointer
    Nov 25 '18 at 3:19











  • @nullpointer tried but not works

    – ikalangita
    Nov 25 '18 at 19:31











  • Thanks all, @ElliottFrisch, it's not working

    – ikalangita
    Nov 25 '18 at 19:36










4




4





JAVA_HOME should be export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/. Although I prefer using SDKMAN! on my mac.

– Elliott Frisch
Nov 24 '18 at 20:15





JAVA_HOME should be export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/. Although I prefer using SDKMAN! on my mac.

– Elliott Frisch
Nov 24 '18 at 20:15













Yeah you should just stop at jdk, the further home directory is creating the confusion

– Yassin Hajaj
Nov 24 '18 at 20:38





Yeah you should just stop at jdk, the further home directory is creating the confusion

– Yassin Hajaj
Nov 24 '18 at 20:38













Or you can add another line export PATH=${PATH}:$JAVA_HOME/bin to the profile

– nullpointer
Nov 25 '18 at 3:19





Or you can add another line export PATH=${PATH}:$JAVA_HOME/bin to the profile

– nullpointer
Nov 25 '18 at 3:19













@nullpointer tried but not works

– ikalangita
Nov 25 '18 at 19:31





@nullpointer tried but not works

– ikalangita
Nov 25 '18 at 19:31













Thanks all, @ElliottFrisch, it's not working

– ikalangita
Nov 25 '18 at 19:36







Thanks all, @ElliottFrisch, it's not working

– ikalangita
Nov 25 '18 at 19:36














1 Answer
1






active

oldest

votes


















0














Step 1: Modify the JAVA_HOME to stop at the "jdk" root. And add the JAVA_HOME/bin to your PATH. Like,



export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk
export PATH=$PATH:$JAVA_HOME/bin


Step 2: Source the correct file. After making the two changes above to your ~/.profile, you do not



source $JAVA_HOME


Instead you



source ~/.profile


Since you're still struggling, I would (as I said in my initial comment), install sdkman!



curl -s "https://get.sdkman.io" | bash


Then you can



sdk use java 11.0.1-open


or



sdk use java 11.0.1-zulu


or



sdk use 8.0.192-zulu


or etc...



sdk ls java


to see available versions. And, sdk ls will show you a plethora of available java based tools you can install. It's wonderful. It's cross platform. It's free.






share|improve this answer


























  • Hi, i did it, when i do java -version i got : Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk//bin/java" (-1) , is it normal?

    – ikalangita
    Nov 25 '18 at 19:48











  • Hi, thanks for help, it not working also so i uninstalled jdk and reinstall and working well now

    – ikalangita
    Nov 25 '18 at 20:02











  • What context are you running this from? If you're inside of an IDE then you need to configure the IDE. The above steps assume you are using a regular command line and the shell's env variables. So... your context matters here.

    – sofend
    Nov 25 '18 at 20:40











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%2f53461960%2fif-you-already-have-installed-the-jdk-verify-your-java-home-environment-variabl%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









0














Step 1: Modify the JAVA_HOME to stop at the "jdk" root. And add the JAVA_HOME/bin to your PATH. Like,



export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk
export PATH=$PATH:$JAVA_HOME/bin


Step 2: Source the correct file. After making the two changes above to your ~/.profile, you do not



source $JAVA_HOME


Instead you



source ~/.profile


Since you're still struggling, I would (as I said in my initial comment), install sdkman!



curl -s "https://get.sdkman.io" | bash


Then you can



sdk use java 11.0.1-open


or



sdk use java 11.0.1-zulu


or



sdk use 8.0.192-zulu


or etc...



sdk ls java


to see available versions. And, sdk ls will show you a plethora of available java based tools you can install. It's wonderful. It's cross platform. It's free.






share|improve this answer


























  • Hi, i did it, when i do java -version i got : Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk//bin/java" (-1) , is it normal?

    – ikalangita
    Nov 25 '18 at 19:48











  • Hi, thanks for help, it not working also so i uninstalled jdk and reinstall and working well now

    – ikalangita
    Nov 25 '18 at 20:02











  • What context are you running this from? If you're inside of an IDE then you need to configure the IDE. The above steps assume you are using a regular command line and the shell's env variables. So... your context matters here.

    – sofend
    Nov 25 '18 at 20:40
















0














Step 1: Modify the JAVA_HOME to stop at the "jdk" root. And add the JAVA_HOME/bin to your PATH. Like,



export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk
export PATH=$PATH:$JAVA_HOME/bin


Step 2: Source the correct file. After making the two changes above to your ~/.profile, you do not



source $JAVA_HOME


Instead you



source ~/.profile


Since you're still struggling, I would (as I said in my initial comment), install sdkman!



curl -s "https://get.sdkman.io" | bash


Then you can



sdk use java 11.0.1-open


or



sdk use java 11.0.1-zulu


or



sdk use 8.0.192-zulu


or etc...



sdk ls java


to see available versions. And, sdk ls will show you a plethora of available java based tools you can install. It's wonderful. It's cross platform. It's free.






share|improve this answer


























  • Hi, i did it, when i do java -version i got : Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk//bin/java" (-1) , is it normal?

    – ikalangita
    Nov 25 '18 at 19:48











  • Hi, thanks for help, it not working also so i uninstalled jdk and reinstall and working well now

    – ikalangita
    Nov 25 '18 at 20:02











  • What context are you running this from? If you're inside of an IDE then you need to configure the IDE. The above steps assume you are using a regular command line and the shell's env variables. So... your context matters here.

    – sofend
    Nov 25 '18 at 20:40














0












0








0







Step 1: Modify the JAVA_HOME to stop at the "jdk" root. And add the JAVA_HOME/bin to your PATH. Like,



export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk
export PATH=$PATH:$JAVA_HOME/bin


Step 2: Source the correct file. After making the two changes above to your ~/.profile, you do not



source $JAVA_HOME


Instead you



source ~/.profile


Since you're still struggling, I would (as I said in my initial comment), install sdkman!



curl -s "https://get.sdkman.io" | bash


Then you can



sdk use java 11.0.1-open


or



sdk use java 11.0.1-zulu


or



sdk use 8.0.192-zulu


or etc...



sdk ls java


to see available versions. And, sdk ls will show you a plethora of available java based tools you can install. It's wonderful. It's cross platform. It's free.






share|improve this answer















Step 1: Modify the JAVA_HOME to stop at the "jdk" root. And add the JAVA_HOME/bin to your PATH. Like,



export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk
export PATH=$PATH:$JAVA_HOME/bin


Step 2: Source the correct file. After making the two changes above to your ~/.profile, you do not



source $JAVA_HOME


Instead you



source ~/.profile


Since you're still struggling, I would (as I said in my initial comment), install sdkman!



curl -s "https://get.sdkman.io" | bash


Then you can



sdk use java 11.0.1-open


or



sdk use java 11.0.1-zulu


or



sdk use 8.0.192-zulu


or etc...



sdk ls java


to see available versions. And, sdk ls will show you a plethora of available java based tools you can install. It's wonderful. It's cross platform. It's free.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 25 '18 at 19:52

























answered Nov 25 '18 at 19:44









Elliott FrischElliott Frisch

155k1393187




155k1393187













  • Hi, i did it, when i do java -version i got : Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk//bin/java" (-1) , is it normal?

    – ikalangita
    Nov 25 '18 at 19:48











  • Hi, thanks for help, it not working also so i uninstalled jdk and reinstall and working well now

    – ikalangita
    Nov 25 '18 at 20:02











  • What context are you running this from? If you're inside of an IDE then you need to configure the IDE. The above steps assume you are using a regular command line and the shell's env variables. So... your context matters here.

    – sofend
    Nov 25 '18 at 20:40



















  • Hi, i did it, when i do java -version i got : Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk//bin/java" (-1) , is it normal?

    – ikalangita
    Nov 25 '18 at 19:48











  • Hi, thanks for help, it not working also so i uninstalled jdk and reinstall and working well now

    – ikalangita
    Nov 25 '18 at 20:02











  • What context are you running this from? If you're inside of an IDE then you need to configure the IDE. The above steps assume you are using a regular command line and the shell's env variables. So... your context matters here.

    – sofend
    Nov 25 '18 at 20:40

















Hi, i did it, when i do java -version i got : Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk//bin/java" (-1) , is it normal?

– ikalangita
Nov 25 '18 at 19:48





Hi, i did it, when i do java -version i got : Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk//bin/java" (-1) , is it normal?

– ikalangita
Nov 25 '18 at 19:48













Hi, thanks for help, it not working also so i uninstalled jdk and reinstall and working well now

– ikalangita
Nov 25 '18 at 20:02





Hi, thanks for help, it not working also so i uninstalled jdk and reinstall and working well now

– ikalangita
Nov 25 '18 at 20:02













What context are you running this from? If you're inside of an IDE then you need to configure the IDE. The above steps assume you are using a regular command line and the shell's env variables. So... your context matters here.

– sofend
Nov 25 '18 at 20:40





What context are you running this from? If you're inside of an IDE then you need to configure the IDE. The above steps assume you are using a regular command line and the shell's env variables. So... your context matters here.

– sofend
Nov 25 '18 at 20:40




















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%2f53461960%2fif-you-already-have-installed-the-jdk-verify-your-java-home-environment-variabl%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







Popular posts from this blog

Wiesbaden

Marschland

Dieringhausen