http://blog.csdn.net/shallowgrave/article/details/39367119
Nothing to do, install a hbase to play, suddenly found that the default installation of Mac JDK7, no configuration java_home not so on their own with Bai.
Open the notes for configuring your Java environment when you configured your Hadoop cluster, and find the step to add an environment variable:
[Plain]View Plaincopyprint?
- Export Java_home=/usr/java/latest
- Export classpath=.: $JAVA _home
- Export path= $PATH: $JAVA _home/bin: $JAVA _home/jre/binexport classpath=.: $JAVA _home/lib: $CLASSPATH
Before it was configured in the Linux environment, switching to another UNIX-like system is now a similar scenario. Just find the actual installation path to the JDK.
Just before the JDK dependency in the configuration maven relies a bit like experience.
[Plain]View Plaincopyprint?
- Shuchen-2:bin seishuchen$ which Java
- /usr/bin/java
- Shuchen-2:bin seishuchen$ Ls-la/usr/bin/java
- Lrwxr-xr-x 1 root Wheel 4-2014/usr/bin/java-/system/library/frameworks/javavm.framework/versions/curren T/commands/java
- Shuchen-2:bin seishuchen$
The real path to the current JDK is quickly found. View path name discovery, there is a versions field and the current field, as a program ape, this is sensitive or some.
Immediately switch to the versions directory below to view:
[Plain]View Plaincopyprint?
- Shuchen-2:versions seishuchen$ cd/system/library/frameworks/javavm.framework/versions
- Shuchen-2:versions seishuchen$ Ls-al
- Total 72
- Drwxr-xr-x root Wheel 408 Jul 15 17:13.
- Drwxr-xr-x root Wheel 408 Apr 11 15:10..
- Lrwxr-xr-x 1 root Wheel 4 1.4-CURRENTJDK
- Lrwxr-xr-x 1 root Wheel 4 1.4.2-CURRENTJDK
- Lrwxr-xr-x 1 root Wheel 4 1.5-CURRENTJDK
- Lrwxr-xr-x 1 root Wheel 4 1.5.0-CURRENTJDK
- Lrwxr-xr-x 1 Root Wheel 4 1.6-CURRENTJDK
- Lrwxr-xr-x 1 root Wheel 4 1.6.0-CURRENTJDK
- Drwxr-xr-x 8 root Wheel 272 Mar 4 A
- Lrwxr-xr-x 1 root Wheel 1 Mar 4 Current-A
- Lrwxr-xr-x 1 root wheel 17:12 currentjdk-/library/java/javavirtualmachines/jdk1.7.0_51.jdk/contents
- Lrwxr-xr-x 1 root Wheel 4 Currentjdk_bak-/system/library/java/javavirtualmachines/1.6.0.jdk/conte Nts
The result is obvious, there is wood, originally all pointed to the/library/java/javavirtualmachines/jdk1.7.0_51.jdk/contents
Then switch to the past and look at it.
[Plain]View Plaincopyprint?
- Shuchen-2:versions seishuchen$ cd/library/java/javavirtualmachines/jdk1.7.0_51.jdk/contents
- Shuchen-2:contents seishuchen$ ls
- Home Info.plist MacOS
- Shuchen-2:contents seishuchen$ CD home/
- Shuchen-2:home seishuchen$ ls
- COPYRIGHT bin Man
- LICENSE DB Release
- Readme.html include Src.zip
- Thirdpartylicensereadme-javafx.txt JRE
- THIRDPARTYLICENSEREADME.txt Lib
- Shuchen-2:home seishuchen$
See the long-lost JDK installation directory is not. Well, our java_home is/library/java/javavirtualmachines/jdk1.7.0_51.jdk/contents/home.
The process looks very complicated, of course, this is for a most primitive method, if you are familiar with the Mac, actually have a java_home to get a small tool, directly on the command line
Enter/usr/libexec/java_home to get.
[Plain]View Plaincopyprint?
- Shuchen-2:home seishuchen$/usr/libexec/java_home
- /library/java/javavirtualmachines/jdk1.7.0_51.jdk/contents/home
- Shuchen-2:home seishuchen$
Then just modify the configuration file to make it effective. Depending on your needs, you can choose to modify the different environment variable profiles.
And I just modify the current user can. As long as the ~/.profile (Mac can also edit ~/.BASHRC, but ~/.bash_profile is not sure, interested can own beforehand)
Join:
[Plain]View Plaincopyprint?
- Java_home= '/usr/libexec/java_home '
- Export Java_home
- Export classpath=.: $JAVA _home
- Export path= $PATH: $JAVA _home/bin: $JAVA _home/jre/bin
- Export classpath=.: $JAVA _home/lib: $CLASSPATH
Then source ~/.profile, OK, call it off.
Execute hbase startup script, use JPS to look at the situation, find everything is so perfect, oh haha
Configure Java_home under Mac