我正在使用MacOS的Sierra版本10.12.4
,并且正在使用zsh shell
。我已经安装了HBase版本1.2.6并尝试运行它。我预先安装了JAVA JDK版本1.8.0_131
。
我在~.bash_profile
和~.zshrc
中设置了$JAVA_HOME
路径,并在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 未设置错误
。
❯ 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
级别运行?