一般来说
任务
I want to run java -jar -Xmx2G -Xms2G /home/pi/minecraft/server/spigot-1.15.2.jar
by clicking a desktop icon (or .desktop file).
When I type the commant into a terminal it works.
问题
终端崩溃。
我尝试过的
我创建了一个.desktop文件,该文件执行一个.sh文件。 我的.desktop文件:
[Desktop Entry]
Version=1.0
Name=Spigot
Comment=
Exec=/home/pi/Desktop/launch_spigot_server.sh
Icon=/home/pi/Pictures/spigot.png
Terminal=true
Type=Application
Categories=Utility;Application;
X-KeepTerminal=true
我的.sh文件:
#!/bin/bash
pkexec java -jar -Xmx2G -Xms2G /home/pi/minecraft/server/spigot-1.15.2.jar
(“ pkexec”,因为我认为我需要使用sudo权限来运行.jar文件)
结果
The Terminal actually opens and executes the .jar file and it says Loading libraries, please wait...
, then throws some sort of Error and instantly crashes.
那是我三个小时来最远的时间。
首先转到目录,然后执行java -jar ...命令