我有一个加载 jar 文件的 shell 脚本。当使用 sudo 执行时,它会加载。但是,当不使用 sudo 时,会出现错误并且无法加载。
外壳脚本:
#!/bin/bash
jversion=$(java -version 2>&1 | grep -i version)
if [ -z "$jversion" ]; then
echo "This software is built using Java technology,"
echo "so please take a moment to install Java to be able to use the software on your computer."
echo ""
exit 1
fi
jv=$(java -version 2>&1 | grep -i version | cut -d'"' -f2 | cut -d'.' -f1-2)
if [ $jv == "1.6" ] || [ $jv == "1.7" ]; then
echo "Your version of Java is not supported."
echo "Please update your Java to version 1.8 to be able to use the software on your computer."
exit 1
fi
java -Duser.dir=/opt/link-assistantcom/ranktracker/resources/ \
-Xms64m \
-Xmx768m \
-Xss1024k \
-XX:CompileCommand=exclude,javax/swing/text/GlyphView,getBreakSpot \
-Djava.net.preferIPv4Stack=true \
-jar /opt/link-assistantcom/ranktracker/bin/ranktracker.jar
我必须删除错误代码才能发布。任何帮助,将不胜感激。