Why does JAVA_HOME fail in Path when the exact path of JAVA_HOME works in the same place?
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:
And then I have used JAVA_HOME in Path (at the bottom, not the top):
And then javac -version fails at the command line:
But if I replace JAVA_HOME with its exact contents in Path:
Then javac -version works:
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
|
show 1 more comment
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:
And then I have used JAVA_HOME in Path (at the bottom, not the top):
And then javac -version fails at the command line:
But if I replace JAVA_HOME with its exact contents in Path:
Then javac -version works:
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
You need to addJAVA_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
|
show 1 more comment
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:
And then I have used JAVA_HOME in Path (at the bottom, not the top):
And then javac -version fails at the command line:
But if I replace JAVA_HOME with its exact contents in Path:
Then javac -version works:
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
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:
And then I have used JAVA_HOME in Path (at the bottom, not the top):
And then javac -version fails at the command line:
But if I replace JAVA_HOME with its exact contents in Path:
Then javac -version works:
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
java windows
asked Nov 24 '18 at 1:50
RCMRCM
22328
22328
You need to addJAVA_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
|
show 1 more comment
You need to addJAVA_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
|
show 1 more comment
1 Answer
1
active
oldest
votes
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.
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
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%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
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.
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
add a comment |
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.
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
add a comment |
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.
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.
answered Nov 24 '18 at 2:57
![](https://i.stack.imgur.com/13Xyn.jpg?s=32&g=1)
![](https://i.stack.imgur.com/13Xyn.jpg?s=32&g=1)
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
add a comment |
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
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%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
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
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