我正在尝试设置JAVA_HOME,以便可以在本教程的帮助下安装Apache Solr。我通过root用户使用ssh连接到服务器
要允许正在运行的sh脚本安装Apache Solr,请执行以下操作:
mount | grep noexec
使用exec选项重新挂载文件系统:
mount -o remount,exec /dev/md1
然后,每次我尝试使用以下命令进行安装时
bin/install_solr_service.sh /tmp/solr-5.3.1.tgz
我收到以下消息:
WARNING: /opt/solr-5.3.1 already exists! Skipping extract ...
Creating /etc/init.d/solr script ...
The currently defined JAVA_HOME (/usr/local/jdk) refers
to a location where Java could not be found. Aborting.
Either fix the JAVA_HOME variable or remove it from the
environment so that the system PATH will be searched.
The currently defined JAVA_HOME (/usr/local/jdk) refers
to a location where Java could not be found. Aborting.
Either fix the JAVA_HOME variable or remove it from the
environment so that the system PATH will be searched.
Service solr installed.
这是我到目前为止尝试过的:
nano /root/.bash_profile
nano /etc/profile
我将以下内容添加到上面的文件中并保存了它们
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-0.b17.el6_7.x86_64
export PATH=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-0.b17.el6_7.x86_64/bin:$PATH
那没用。
我创建了以下文件/etc/profile.d/java.sh并放入其中:
export JRE_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-0.b17.el6_7.x86_64/jre/
export PATH=$PATH:$JRE_HOME/bin
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-0.b17.el6_7.x86_64
export JAVA_PATH=$JAVA_HOME
export PATH=$PATH:$JAVA_HOME/bin
并运行以下命令:
source java.sh
那也没有用。
我试图运行以下命令:
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-0.b17.el6_7.x86_64
完全没有运气。
但是当运行以下命令时,我得到的是
echo $JAVA_HOME
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-0.b17.el6_7.x86_64
echo $PATH
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-0.b17.el6_7.x86_64/bin:/usr/local/jdk/bin:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-0.b17.el6_7.x86_64/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-0.b17.el6_7.x86_64/jre//bin:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-0.b17.el6_7.x86_64/bin:/usr/local/bin:/usr/X11R6/bin:/root/bin