Assuming you use bash shell and installed Java with the Oracle installer, you could add the following to your
.bash_profile
export JAVA_HOME=$(/usr/libexec/java_home)
export PATH=$JAVA_HOME/jre/bin:$PATH
This would pick the correct JAVA_HOME
as defined by the Oracle installer and will set it first in your $PATH
making sure it is found.
Also, you don’t need to change it later when updating Java.
From:https://stackoverflow.com/questions/27319495/error-java-home-is-not-defined-correctly-executing-maven
Read More:
- keytool error: java.lang.Exception: Input not an X.509 certificate
- Java Running Error: Could not find or load main class
- The node requests the API address written by java to report an error error:getaddrinfo ENOTFOUND
- Maven (http://repo1.maven.org/maven2/): Failed to transfer file and PKIX path building failed: sun.secu
- Java error: unable to find or load main class (package name in source file)
- Build a mybatis and it will appear session.selectOne Method error
- java.util.zip.zipexception: error in opening zip file
- keytool error java.io.IOException:keystore was tampered with,or password was incorre
- Mongodb java version 3.X, prompt “XXX (an encryption algorithm) is not available” when there is a user name and password
- Error in make when installing redis6.0 in centos7
- How to Solve Error: Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package.
- Java error prompt….. cannot be resolved
- Idea error: (44,22) Java: constant string too long
- [Solved] error:could not open…….error a fatal exception……..
- Xdoc generates API documents based on Java annotations
- Tensorflow Error TypeError: Fetch argument XXXX has invalid typeXXXX,must be a string or Tensor
- Resources is configured in the build of Maven project to prevent the failure of resource export
- [How to Solve]Repeated column in mapping for entity,should be mapped with insert=“false“ update=“false“
- [How to Solve Error]java.util.Date cannot be cast to java.sql.Date
- Ternary operator in Java?: error: not a statement