It’s a magic question. The system was running, and suddenly it hung up. Various Java packages are missing
1. Check maven configuration.bash_ profile
2. Check the run call file. Mavenrc 2
Run Java – version, no problem, normal
Run MVN – version, oh
Error: JAVA_HOME is not defined correctly.
We cannot execute Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/bin/java
And then you start to flip through the configuration file
##### Explain the two jdk versions 7 and 8 on your machine, this command determines your Java version
echo $JAVA_HOME
##### is normally 8
Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home
##### check if maven is missing also normal
which mvn
/Users/****/Documents/maven/apache-maven-3.3.9/bin/mvn
##### started checking the configuration files and they were fine
vim ~/.bash_profile
Checked PATH=$PATH:$MAVEN_HOME/bin and it's not missing (maven configuration at the end of the article)
I started to feel depressed, so I checked another file called by Maven runtime
##### into the root home
cd $HOME
##### Find the file
ls -a
##### No .mavenrc found
##### depressed 。。。。
##### hit directly
vim .mavenrc
##### and type in
JAVA_HOME=$(/usr/libexec/java_home)
##### save
ESC ---- :wq!
##### Check
mvn -version
##### normal
Apache Maven 3.3.9
Error: JAVA_HOME is not defined correctly. We cannot execute Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/bin/java
Similar Posts:
- [Solved] Mac install maven Error: zsh: command not found: MVN
- [Solved] JMeter startup error: integer expression expected
- [Solved] NB: JAVA_HOME should point to a JDK not a JRE
- objc[20556]:Class JavaLaunchHelper is implemented in both xxx [How to Solve]
- gradle –version Error: ERROR: JAVA_HOME is set to an invalid directory: /usr/local/opt/openjdk
- JAVA Command Error: A JNI error has occurred, please check your installation and try again [Solved]
- Mac ADB prompts command not found
- Mac Mvn Package Error: No compiler is provided in this environment. Perhaps you are running on a JRE rather …
- The CATALINA_HOME environment variable is not defined correctly
- [791] Maven configuration error and the Java_ The solution of home environment variable is not defined correctly