Thursday, May 9, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 4088  / 3 Years ago, wed, may 5, 2021, 2:39:43

I have a .desktop file for a bash script, but when I launch the .desktop file nothing happens except that a terminal window is shown for half a second.



If I run the bash script directly (without the .desktop file), the script works fine (bash file is called 'minecraft'):



#!/bin/bash
java -Xmx1024M -Xms512M -cp minecraft.jar net.minecraft.LauncherFrame


The file is executable.



This is my minecraft.desktop file:



[Desktop Entry]
Type=Application
Name=Minecraft
Comment=Minecraft
Icon=/home/bram/Applications/Minecraft/icon.png
Exec=/home/bram/Applications/Minecraft/minecraft
Terminal=true
Categories=Minecraft;game


minecraft.desktop is located in ~/.local/share/applications


More From » bash

 Answers
5

Apparently the script couldn't find the .jar file.
When I run the bash file using the .desktop file, I assume it runs the bash file in the directory of the .desktop file (~/.local/share/applications).



When I give the full path name to the jar, it works fine:



#!/bin/bash
java -Xmx1024M -Xms512M -cp /home/bram/Applications/Minecraft/minecraft.jar net.minecraft.LauncherFrame

[#36154] Thursday, May 6, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
confiorc

Total Points: 42
Total Questions: 121
Total Answers: 123

Location: India
Member since Wed, Aug 26, 2020
4 Years ago
;