ERROR: JAVA_HOME is set to an invalid directory: /usr/libexec/java_home code example

Example: error java_home is set to an invalid directory

// Don't include /bin in path variable
// It should be only

JAVA_HOME=D:\Setup\Open_JDK\openjdk\jdk-11.0.2
  
// If still no luck then add JRE_HOME also

JRE_HOME=D:\Setup\Open_JDK\openjdk\jdk-11.0.2  
  
// Make sure your System variable is not 
// overiding your User variable.  
// If so then remove user JAVA_HOME or JRE_HOME from User variable 
// and add only one JAVA_HOME in System variables

Tags:

Java Example