第 56 行:/bin/java:没有此文件或目录

第 56 行:/bin/java:没有此文件或目录

zmprov我在 Ubuntu 16.04 上运行时遇到了这个问题:

/opt/zimbra/bin/zmjava: line 56:/bin/java: no such file or directory.

我运行了所需的命令但无法解决问题,以下是有关我的系统的一些有用信息:

java -version
openjdk version "1.8.0_282"
OpenJDK Runtime Environment (build 1.8.0_282-8u282-b08-0ubuntu1~16.04-b08)
OpenJDK 64-Bit Server VM (build 25.282-b08, mixed mode)

dpkg --list | grep -i jdk
ii default-jdk 2:1.8-56ubuntu2 amd64 Standard Java or Java compatible Development Kit
ii default-jdk-headless 2:1.8-56ubuntu2 amd64 Standard Java or Java compatible Development Kit (headless)
ii openjdk-8-jdk:amd64 8u282-b08-0ubuntu1~16.04 amd64 OpenJDK Development Kit (JDK)
ii openjdk-8-jdk-headless:amd64 8u282-b08-0ubuntu1~16.04 amd64 OpenJDK Development Kit (JDK) (headless)
ii openjdk-8-jre:amd64 8u282-b08-0ubuntu1~16.04 amd64 OpenJDK Java runtime, using Hotspot JIT
ii openjdk-8-jre-headless:amd64 8u282-b08-0ubuntu1~16.04 amd64 OpenJDK Java runtime, using Hotspot JIT (headless)
ii oracle-java8-installer 8u201-1~webupd8~1 all Oracle Java(TM) Development Kit JDK) 8
ii oracle-java8-set-default 8u201-1~webupd8~1 all Set Oracle JDK 8 as default Java
ii zimbra-openjdk 1.8.0u172b01-1zimbra8.7b5.16.04 amd64 OpenJDK
ii zimbra-openjdk-cacerts 1.0.5-1zimbra8.7b1.16.04 all CA Certs keystore for OpenJDK

dpkg -l | grep openjdk
ii openjdk-8-jdk:amd64 8u282-b08-0ubuntu1~16.04 amd6 OpenJDK Development Kit (JDK)
ii openjdk-8-jdk-headless:amd64 8u282-b08-0ubuntu1~16.04 amd64 OpenJDK Development Kit (JDK) (headless)
ii openjdk-8-jre:amd64 8u282-b08-0ubuntu1~16.04 amd64 OpenJDK Java runtime, using Hotspot JIT
ii openjdk-8-jre-headless:amd64 8u282-b08-0ubuntu1~16.04 amd64 OpenJDK Java runtime, using Hotspot JIT (headless)
ii zimbra-openjdk 1.8.0u172b01-1zimbra8.7b5.16.04 amd64 OpenJDK
ii zimbra-openjdk-cacerts 1.0.5-1zimbra8.7b1.16.04 all CA Certs keystore for OpenJDK

which java
/usr/bin/java

whereis java
java: /usr/bin/java /usr/share/java /usr/share/man/man1/java.1.gz

find / -name java -type f -executable
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
/usr/lib/jvm/java-8-oracle/jre/bin/java
/usr/lib/jvm/java-8-oracle/bin/java
/opt/zimbra/common/lib/jvm/openjdk-1.8.0_172-zimbra/jre/bin/java
/opt/zimbra/common/lib/jvm/openjdk-1.8.0_172-zimbra/bin/java

if [[ -e "/opt/zimbra/common/bin/java" ]]; then echo "true"; else echo "Java is not found in /opt/zimbra"; exit 1; fi true

您可能同时安装了多个版本的 Java。我运行以下命令:

sudo update-alternatives --config java
There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
Nothing to configure.

sudo update-alternatives --config javac
There are 2 choices for the alternative javac (providing /usr/bin/javac)
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-8-oracle/bin/javac 1081 auto mode
1 /usr/lib/jvm/java-8-openjdk-amd64/bin/javac 1081 manual mode
* 2 /usr/lib/jvm/java-8-oracle/bin/javac 1081 manual mode
Press <enter> to keep the current choice[*], or type selection number:

sudo ln -s /usr/bin/java /opt/zimbra/common/bin/java
ln: failed to create symbolic link '/opt/zimbra/common/bin/java': File exists

sudo ls -hal /opt/zimbra/common/bin/java
lrwxrwxrwx 1 root root 24 May 28 2018 /opt/zimbra/common/bin/java -> ../lib/jvm/java/bin/java

sudo ls -la /opt/zimbra/common/bin/java
lrwxrwxrwx 1 root root 24 May 28 2018 /opt/zimbra/common/bin/java -> ../lib/jvm/java/bin/java

sudo ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 May 13 2019 /usr/bin/java -> /etc/alternatives/java

cat /etc/profile (If, it is required. I can send you the information)
cat /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
JAVA_HOME="/usr/lib/jvm/java-8-oracle/jre/bin/java"

su – zimbra
zmlocalconfig -q | grep '^zimbra.*home ='
zimbra_home = /opt/zimbra
zimbra_java_home = /opt/zimbra/common/lib/jvm/java

grep -i java .bashrc
JAVA_HOME=/opt/zimbra/common/lib/jvm/java
export JAVA_HOME
PATH=/opt/zimbra/bin:${JAVA_HOME}/bin:/opt/zimbra/common/bin:/opt/zimbra/common/sbin:/usr/sbin:${PATH}

cat .bashrc
JAVA_HOME=/opt/zimbra/common/lib/jvm/java
export JAVA_HOME
PATH=/opt/zimbra/bin:${JAVA_HOME}/bin:/opt/zimbra/common/bin:/opt/zimbra/common/sbin:/usr/sbin:${PATH}
export PATH

which java
/opt/zimbra/common/lib/jvm/java/bin/java
bash -x $(which zmprov) exit
+ source /opt/zimbra/bin/zmshutil
++ dirname /opt/zimbra/bin/zmprov
+ exec /opt/zimbra/bin/zmjava com.zimbra.cs.account.ProvUtil exit
/opt/zimbra/bin/zmjava: line 56: /bin/java: No such file or directory

我该如何修复它或者我应该运行什么?

答案1

谢谢你回答我的问题。是的,第一个命令是在 ubuntu 中,其他命令传递给 zimbra:苏 - 齐姆布拉

相关内容