Ubuntu:14.04.4 LTS
Java 版本:1.8.0_74
我通过以下方式安装了 Jstock (1.0.7.13):
http://jstock.org/help_install_upgrade.html#install-linux
所以我通过./jstock.sh
当我启动 Jstock 时我得到:
警告:/usr/bin 不存在
然后程序启动。
即使文件夹显然存在,而且我也找到了/usr/share/java
,所以这也存在。
当我输入时,whereis java
它显示:
java:/usr/bin/java /usr/bin/X11/java /usr/share/java /usr/share/java /usr/share/man/man1/java.1.gz
该jstock.sh
文件称:
#!/bin/bash
#
# Normally, editing this script should not be required.
# Only case is to set up JAVA_HOME if it's not already defined.
#
# To specify an alternative JVM, edit and uncomment the following
# line and change the path accordingly.
#JAVA_HOME=/usr/share/java
_JAVA_EXEC="java"
if [ -n $JAVA_HOME ] ; then
_TMP="$JAVA_HOME/usr/bin"
if [ -f "$_TMP" ] ; then
if [ -x "$_TMP" ] ; then
_JAVA_EXEC="$_TMP"
else
echo "Warning: $_TMP is not executable"
fi
else
echo "Warning: $_TMP does not exist"
fi
fi
if ! which "$_JAVA_EXEC" >/dev/null ; then
echo "Error: No Java Runtime Environment found"
echo "Please set the environment variable JAVA_HOME to the root directory of your SUN Java installation, e.g. by editing the 7th line in this launcher script."
exit 1
fi
#
# Resolve the location of the JStock installation.
# This includes resolving any symlinks.
PRG=$0
while [ -h "$PRG" ]; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '^.*-> \(.*\)$' 2>/dev/null`
if expr "$link" : '^/' 2> /dev/null >/dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
JSTOCK_BIN=`dirname "$PRG"`
cd "${JSTOCK_BIN}"
_VMOPTIONS="-Xms64m -Xmx512m"
$_JAVA_EXEC $_VMOPTIONS -jar jstock.jar
该程序运行良好,但由于我想在现实中使用它,所以我希望该程序能够完全运行,没有任何错误。
顺便说一句:我怎样才能像正常人一样在这里写字?我留了一些奇怪的空格,以避免把所有内容都写在一行中。谢谢!
答案1
将该线路改为_TMP="$JAVA_HOME/usr/bin
对_TMP="$JAVA_HOME/usr/bin/java
我有用。