在列表中安装了Java,但执行会生成“./java:没有这样的文件或目录”
我刚刚运行了下面的脚本,它将JDK提取并解压缩到正确的位置。问题是每个命令(复制到 /urs/bin)都会出错。然后,我通过(我现在在JDK / bin中)进入JDK安装目录进行双重检查,然后键入:并得到:,但在那里! 上显示所有客户端都在箱内。java
cd
./java -version
./java: No such file or directory
java
ls -l
java
#!/bin/bash
#Author: Yucca Nel http://thejarbar.org
#Will restart system
#Modify these variables as needed...
tempWork=/tmp/work
locBin=/usr/local/bin
javaUsrLib=/usr/lib/jvm
sudo mkdir -p $javaUsrLib
mkdir -p $tempWork
cd $tempWork
#Update this line to reflect newer versions of JDK...
wget http://download.oracle.com/otn-pub/java/jdk/7u2-b13/jdk-7u2-linux-i586.tar.gz
#Extract the download
tar -zxvf $tempWork/*
#Move it to where it can be found...
sudo mv -f $tempWork/jdk1.7* $javaUsrLib/
sudo ln -f -s $javaUsrLib/jdk1.7*/bin/* /usr/bin/
sudo rm -rf $tempWork
#Update this line to reflect newer versions of JDK...
export JAVA_HOME="$javaUsrLib/jdk1.7.0_02"
if ! grep "JAVA_HOME=$javaUsrLib/jdk1.7.0_02" /etc/environment
then
echo "JAVA_HOME=$javaUsrLib/jdk1.7.0_02"| sudo tee -a /etc/environment
fi
sudo /sbin/reboot
exit 0
跑步给了我:ls -l /usr/lib/jvm/jdk1.7.0_02/bin/java
yucca@yucca-VirtualBox:~$
-rwxr-xr-x 1 yucca yucca 5654 2011-11-17 22:38 /usr/lib/jvm/jdk1.7.0_02/bin/java
还运行:输出为:file /usr/lib/jvm/jdk1.7.0_02/bin
/usr/lib/jvm/jdk1.7.0_02/bin: directory