Why does JAVA_HOME fail in Path when the exact path of JAVA_HOME works in the same place?












2















I note to begin with that a very related question has been asked before, but the answer was to restart the system which does not work for me. Here is that link if anyone is interested:



WINDOWS 10 JAVA_HOME is not working



Also, there are several similar discussions about Path, and the answers seem to involve the order in which entries appear in the path, or a registry reset, however that does not appear to be the case here, since my working and non-working solution use the same order and the same registry settings. I did not list these since there are several.



But my case is that I have set JAVA_HOME:



enter image description here



And then I have used JAVA_HOME in Path (at the bottom, not the top):



enter image description here



And then javac -version fails at the command line:



enter image description here



But if I replace JAVA_HOME with its exact contents in Path:



enter image description here



Then javac -version works:



enter image description here



So, seemingly a pointless question since I can make it work. However, I am wondering why partly in the interest of knowing what is going on and partly in the interest of knowing if JAVA_HOME will fail if used elsewhere.










share|improve this question























  • You need to add JAVA_HOMEbin to path. javac is not in the top level dir

    – flakes
    Nov 24 '18 at 1:51











  • @flakes but isn't %JAVA_HOME%bin the last line of my path (second image)?

    – RCM
    Nov 24 '18 at 1:52











  • Also, I did try JAVA_HOME (followed by bin) without the enclosing %% as in my example and this failed too, but again, the simple path contents of JAVA_HOME (followed by bin of course) does work ...

    – RCM
    Nov 24 '18 at 2:04






  • 2





    @RCM define both variables in the same scope, not system vs. user.

    – Martin Zeitler
    Nov 24 '18 at 2:04






  • 1





    It does appear to be that the JAVA_HOME has to be a system variable not a user variable. I guess maybe that's obvious?! Not to me, lol! Martin Zeitler since you were first to say this, do you want points for the answer? Write it and I'll choose you. Otherwise in a day or so I'll write it just so others can easily find it.

    – RCM
    Nov 24 '18 at 2:20


















2















I note to begin with that a very related question has been asked before, but the answer was to restart the system which does not work for me. Here is that link if anyone is interested:



WINDOWS 10 JAVA_HOME is not working



Also, there are several similar discussions about Path, and the answers seem to involve the order in which entries appear in the path, or a registry reset, however that does not appear to be the case here, since my working and non-working solution use the same order and the same registry settings. I did not list these since there are several.



But my case is that I have set JAVA_HOME:



enter image description here



And then I have used JAVA_HOME in Path (at the bottom, not the top):



enter image description here



And then javac -version fails at the command line:



enter image description here



But if I replace JAVA_HOME with its exact contents in Path:



enter image description here



Then javac -version works:



enter image description here



So, seemingly a pointless question since I can make it work. However, I am wondering why partly in the interest of knowing what is going on and partly in the interest of knowing if JAVA_HOME will fail if used elsewhere.










share|improve this question























  • You need to add JAVA_HOMEbin to path. javac is not in the top level dir

    – flakes
    Nov 24 '18 at 1:51











  • @flakes but isn't %JAVA_HOME%bin the last line of my path (second image)?

    – RCM
    Nov 24 '18 at 1:52











  • Also, I did try JAVA_HOME (followed by bin) without the enclosing %% as in my example and this failed too, but again, the simple path contents of JAVA_HOME (followed by bin of course) does work ...

    – RCM
    Nov 24 '18 at 2:04






  • 2





    @RCM define both variables in the same scope, not system vs. user.

    – Martin Zeitler
    Nov 24 '18 at 2:04






  • 1





    It does appear to be that the JAVA_HOME has to be a system variable not a user variable. I guess maybe that's obvious?! Not to me, lol! Martin Zeitler since you were first to say this, do you want points for the answer? Write it and I'll choose you. Otherwise in a day or so I'll write it just so others can easily find it.

    – RCM
    Nov 24 '18 at 2:20
















2












2








2


0






I note to begin with that a very related question has been asked before, but the answer was to restart the system which does not work for me. Here is that link if anyone is interested:



WINDOWS 10 JAVA_HOME is not working



Also, there are several similar discussions about Path, and the answers seem to involve the order in which entries appear in the path, or a registry reset, however that does not appear to be the case here, since my working and non-working solution use the same order and the same registry settings. I did not list these since there are several.



But my case is that I have set JAVA_HOME:



enter image description here



And then I have used JAVA_HOME in Path (at the bottom, not the top):



enter image description here



And then javac -version fails at the command line:



enter image description here



But if I replace JAVA_HOME with its exact contents in Path:



enter image description here



Then javac -version works:



enter image description here



So, seemingly a pointless question since I can make it work. However, I am wondering why partly in the interest of knowing what is going on and partly in the interest of knowing if JAVA_HOME will fail if used elsewhere.










share|improve this question














I note to begin with that a very related question has been asked before, but the answer was to restart the system which does not work for me. Here is that link if anyone is interested:



WINDOWS 10 JAVA_HOME is not working



Also, there are several similar discussions about Path, and the answers seem to involve the order in which entries appear in the path, or a registry reset, however that does not appear to be the case here, since my working and non-working solution use the same order and the same registry settings. I did not list these since there are several.



But my case is that I have set JAVA_HOME:



enter image description here



And then I have used JAVA_HOME in Path (at the bottom, not the top):



enter image description here



And then javac -version fails at the command line:



enter image description here



But if I replace JAVA_HOME with its exact contents in Path:



enter image description here



Then javac -version works:



enter image description here



So, seemingly a pointless question since I can make it work. However, I am wondering why partly in the interest of knowing what is going on and partly in the interest of knowing if JAVA_HOME will fail if used elsewhere.







java windows






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 24 '18 at 1:50









RCMRCM

22328




22328













  • You need to add JAVA_HOMEbin to path. javac is not in the top level dir

    – flakes
    Nov 24 '18 at 1:51











  • @flakes but isn't %JAVA_HOME%bin the last line of my path (second image)?

    – RCM
    Nov 24 '18 at 1:52











  • Also, I did try JAVA_HOME (followed by bin) without the enclosing %% as in my example and this failed too, but again, the simple path contents of JAVA_HOME (followed by bin of course) does work ...

    – RCM
    Nov 24 '18 at 2:04






  • 2





    @RCM define both variables in the same scope, not system vs. user.

    – Martin Zeitler
    Nov 24 '18 at 2:04






  • 1





    It does appear to be that the JAVA_HOME has to be a system variable not a user variable. I guess maybe that's obvious?! Not to me, lol! Martin Zeitler since you were first to say this, do you want points for the answer? Write it and I'll choose you. Otherwise in a day or so I'll write it just so others can easily find it.

    – RCM
    Nov 24 '18 at 2:20





















  • You need to add JAVA_HOMEbin to path. javac is not in the top level dir

    – flakes
    Nov 24 '18 at 1:51











  • @flakes but isn't %JAVA_HOME%bin the last line of my path (second image)?

    – RCM
    Nov 24 '18 at 1:52











  • Also, I did try JAVA_HOME (followed by bin) without the enclosing %% as in my example and this failed too, but again, the simple path contents of JAVA_HOME (followed by bin of course) does work ...

    – RCM
    Nov 24 '18 at 2:04






  • 2





    @RCM define both variables in the same scope, not system vs. user.

    – Martin Zeitler
    Nov 24 '18 at 2:04






  • 1





    It does appear to be that the JAVA_HOME has to be a system variable not a user variable. I guess maybe that's obvious?! Not to me, lol! Martin Zeitler since you were first to say this, do you want points for the answer? Write it and I'll choose you. Otherwise in a day or so I'll write it just so others can easily find it.

    – RCM
    Nov 24 '18 at 2:20



















You need to add JAVA_HOMEbin to path. javac is not in the top level dir

– flakes
Nov 24 '18 at 1:51





You need to add JAVA_HOMEbin to path. javac is not in the top level dir

– flakes
Nov 24 '18 at 1:51













@flakes but isn't %JAVA_HOME%bin the last line of my path (second image)?

– RCM
Nov 24 '18 at 1:52





@flakes but isn't %JAVA_HOME%bin the last line of my path (second image)?

– RCM
Nov 24 '18 at 1:52













Also, I did try JAVA_HOME (followed by bin) without the enclosing %% as in my example and this failed too, but again, the simple path contents of JAVA_HOME (followed by bin of course) does work ...

– RCM
Nov 24 '18 at 2:04





Also, I did try JAVA_HOME (followed by bin) without the enclosing %% as in my example and this failed too, but again, the simple path contents of JAVA_HOME (followed by bin of course) does work ...

– RCM
Nov 24 '18 at 2:04




2




2





@RCM define both variables in the same scope, not system vs. user.

– Martin Zeitler
Nov 24 '18 at 2:04





@RCM define both variables in the same scope, not system vs. user.

– Martin Zeitler
Nov 24 '18 at 2:04




1




1





It does appear to be that the JAVA_HOME has to be a system variable not a user variable. I guess maybe that's obvious?! Not to me, lol! Martin Zeitler since you were first to say this, do you want points for the answer? Write it and I'll choose you. Otherwise in a day or so I'll write it just so others can easily find it.

– RCM
Nov 24 '18 at 2:20







It does appear to be that the JAVA_HOME has to be a system variable not a user variable. I guess maybe that's obvious?! Not to me, lol! Martin Zeitler since you were first to say this, do you want points for the answer? Write it and I'll choose you. Otherwise in a day or so I'll write it just so others can easily find it.

– RCM
Nov 24 '18 at 2:20














1 Answer
1






active

oldest

votes


















1














If your %JAVA_HOME% variable is in the user variables scope, you must be logged in from that specific user account (*Checked on Windows 7).



Or as Martin Zeitler has mentioned in the comments, best option is to put both variables in the same scope.






share|improve this answer
























  • OK, I will accept this one since Martin Zeitler never came back and wrote his comment as an answer...even though he was the first to point out what I think is the main issue...JAVA_HOME must be a system variable (not a user variable) .

    – RCM
    Nov 29 '18 at 2:30













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%2f53454523%2fwhy-does-java-home-fail-in-path-when-the-exact-path-of-java-home-works-in-the-sa%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









1














If your %JAVA_HOME% variable is in the user variables scope, you must be logged in from that specific user account (*Checked on Windows 7).



Or as Martin Zeitler has mentioned in the comments, best option is to put both variables in the same scope.






share|improve this answer
























  • OK, I will accept this one since Martin Zeitler never came back and wrote his comment as an answer...even though he was the first to point out what I think is the main issue...JAVA_HOME must be a system variable (not a user variable) .

    – RCM
    Nov 29 '18 at 2:30


















1














If your %JAVA_HOME% variable is in the user variables scope, you must be logged in from that specific user account (*Checked on Windows 7).



Or as Martin Zeitler has mentioned in the comments, best option is to put both variables in the same scope.






share|improve this answer
























  • OK, I will accept this one since Martin Zeitler never came back and wrote his comment as an answer...even though he was the first to point out what I think is the main issue...JAVA_HOME must be a system variable (not a user variable) .

    – RCM
    Nov 29 '18 at 2:30
















1












1








1







If your %JAVA_HOME% variable is in the user variables scope, you must be logged in from that specific user account (*Checked on Windows 7).



Or as Martin Zeitler has mentioned in the comments, best option is to put both variables in the same scope.






share|improve this answer













If your %JAVA_HOME% variable is in the user variables scope, you must be logged in from that specific user account (*Checked on Windows 7).



Or as Martin Zeitler has mentioned in the comments, best option is to put both variables in the same scope.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 24 '18 at 2:57









Roshana PitigalaRoshana Pitigala

4,62962348




4,62962348













  • OK, I will accept this one since Martin Zeitler never came back and wrote his comment as an answer...even though he was the first to point out what I think is the main issue...JAVA_HOME must be a system variable (not a user variable) .

    – RCM
    Nov 29 '18 at 2:30





















  • OK, I will accept this one since Martin Zeitler never came back and wrote his comment as an answer...even though he was the first to point out what I think is the main issue...JAVA_HOME must be a system variable (not a user variable) .

    – RCM
    Nov 29 '18 at 2:30



















OK, I will accept this one since Martin Zeitler never came back and wrote his comment as an answer...even though he was the first to point out what I think is the main issue...JAVA_HOME must be a system variable (not a user variable) .

– RCM
Nov 29 '18 at 2:30







OK, I will accept this one since Martin Zeitler never came back and wrote his comment as an answer...even though he was the first to point out what I think is the main issue...JAVA_HOME must be a system variable (not a user variable) .

– RCM
Nov 29 '18 at 2:30




















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%2f53454523%2fwhy-does-java-home-fail-in-path-when-the-exact-path-of-java-home-works-in-the-sa%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

Contact image not getting when fetch all contact list from iPhone by CNContact

Insert data from modal to MySQL (multiple modal on website)

count number of partitions of a set with n elements into k subsets