Sherum
Sherum

Reputation: 69

Windows 10 JAVA_HOME environment variable ignored

When I run java -version from the command line it returns jre1.8.0_91. I've used setx from the command line and edited the environment variable for JAVA_HOME. The command line seem to be overridden or ignoring the environment variable. All JDK needing commands like mvn error with: "you must set JAVA_HOME to a jdk not a jre"

JAVA_HOME=C:\Program Files\Java\jdk-11.0.6;C:\Program Files\Java\jdk1.8.0_241

Upvotes: 0

Views: 3055

Answers (1)

eis
eis

Reputation: 53462

JAVA_HOME should point to one directory only, you can't have two there. That's why your Maven does not work. Fix that and Maven should work.

java -version output is not directly related, that command does not use JAVA_HOME but PATH (but as noted in the comments, it is possible that PATH refers to JAVA_HOME, so in that case they are indirectly related).

Upvotes: 4

Related Questions