简体   繁体   中英

Failed to run command `/opt/jdk1.8.0_131/bin/java': No such file or directory

I have java environment installed on my server

java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

Java Setup variables Path:

export JAVA_HOME=/opt/jdk1.8.0_171
export JRE_HOME=/opt/jdk1.8.0_171/jre
export PATH=$PATH:/opt/jdk1.8.0_171/bin:/opt/jdk1.8.0_171/jre/bin

When i run my application that use java i still get this error even its installed

nohup: failed to run command `/opt/jdk1.8.0_131/bin/java': No such file or directory

First modify the .bashrc file like below, you don't need JRE_HOME

export JAVA_HOME=/opt/jdk1.8.0_171
export PATH=$JAVA_HOME/bin:$PATH

This would be sufficient, and chown that jdk1.8.0_171 to user level

sudo chown user:group jdk1.8.0_171

For Example sudo chown deadpool:deadpool jdk1.8.0_171 And check java -v and which java

Observe the Error its looking for directory jdk1.8.0_131 but in path your directory is jdk1.8.0_171

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM