我正在使用MacOS Sierra version 10.12.4
并使用zsh shell
。我安装了HBase version 1.2.6并尝试运行它。我已经预先安装了JAVA JDK version 1.8.0_131
。
我在$JAVA_HOME
和~.bash_profile
以及~.zshrc
文件中设置了hbase-1.2.6/conf/hbase-env.sh
路径。因此,当我运行以下命令时,它会显示此
❯ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/
❯ $JAVA_HOME/bin/java -version [16:55:16]
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
但是,当我在文件夹hbase-1.2.6
内运行以下命令时
要运行HBase,它会给我JAVA_HOME is not set error
。
❯ sudo bin/start-hbase.sh
Password:
+======================================================================+
| Error: JAVA_HOME is not set |
+----------------------------------------------------------------------+
| Please download the latest Sun JDK from the Sun Java web site |
| > http://www.oracle.com/technetwork/java/javase/downloads |
| |
| HBase requires Java 1.7 or later. |
+======================================================================+
❯ sudo bin/hbase shell [16:58:36]
+======================================================================+
| Error: JAVA_HOME is not set |
+----------------------------------------------------------------------+
| Please download the latest Sun JDK from the Sun Java web site |
| > http://www.oracle.com/technetwork/java/javase/downloads |
| |
| HBase requires Java 1.7 or later. |
+======================================================================+ |
我可以在用户级别运行它而不使用sudo
。我怎样才能在sudo级别运行?
答案 0 :(得分:0)
你应该运行
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/
在HBase
指针内运行HBase
之前。并检查JAVA_HOME
是否指向Linux中的正确目录。
答案 1 :(得分:0)
Step 1: Search JAVA_HOME in hbase-env.sh
Step 2: Comment out # from JAVA_HOME line and edit the JAVA_HOME directory