2

Ubuntu 20.04 on Hyper-V VM

I have tried following this but having no luck. The file shows in the app drawer but nothing happens when I click it. Here is what I have in my jmol.desktop file.

[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Jmol
Comment=Jmol-14.31.0
Exec=/home/adamch/Downloads/Jmol-14.31.0-binary/jmol-14.31.0/Jmol.jar
Icon=/home/adamch/Downloads/Jmol_icon_win.ico
Terminal=false
StartupWMClass=Jmol

The app works in the terminal by using java -jar Jmol.jar so is there a way to put that in the .desktop file and make it work?

Adam Ch
  • 183

3 Answers3

1

Use the Path key to change the working directory and run java -jar Jmol.jar:

[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Jmol
Comment=Jmol-14.31.0
Exec=java -jar Jmol.jar
Terminal=false
StartupWMClass=Jmol
Path=/home/adamch/Downloads/Jmol-14.31.0-binary/jmol-14.31.0/
Hidden=false
0

Why don't you write a short script that just executes the file properly, and add THAT to the app drawer? Open a text editor, write java -jar /home/adamch/Downloads/Jmol-14.31.0-binary/jmol-14.31.0/Jmol.jar As the script, then save it as Jmol.sh.

[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Jmol
Comment=Jmol-14.31.0
Exec=/home/adamch/Downloads/Jmol-14.31.0-binary/jmol-14.31.0/Jmol.sh
Terminal=false
StartupWMClass=Jmol
Hidden=false
Gabu
  • 1
0

Safer to first check the full path of the java application launcher command -v java or command -pv java to avoid aliases. It will return the full path, in my case /usr/bin/java. Also icons must be in one of these formats: PNG, XPM and SVG.

[Desktop Entry]
Version=1.1
Type=Application
Name=Jmol
GenericName=3D Chemical Structure Viewer
Comment=Jmol-14.31.0
Exec=/usr/bin/java -jar jmol.jar
Path=/home/adamch/Downloads/Jmol-14.31.0-binary/jmol-14.31.0/
Icon=/home/adamch/Downloads/Jmol_icon_win.png
Terminal=false
StartupWMClass=Jmol
StartupNotify=true

https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html

Once the file is correct (appears on the programs list, overview etc.), to put on favourites, if you're using Ubuntu with Gnome, you can press the Meta key to open the Overview and type the name of the program you want, after just move it to the dock.

msmafra
  • 195