How to properly install latest Jabref?

I downloaded JabRef-3.2.jar. I can execute it from the command line:

java -jar JabRef-3.2.jar

which works fine. But I would like to have a Launcher in my start menu, if possible with an appropriate icon. How can I do this?

Note: I am running Xubuntu 15.04.


Solution 1:

First, change directory

cd ~/.local/share/applications

Then, open nano editor:

nano JabRef.desktop

Add the following to the file:

[Desktop Entry]
Type=Application
Terminal=false
Icon=PATH TO YOUR ICON
Exec=java -jar /path/to/your/JabRef-3.2.jar
Name=NAME YOUR DESKTOP ICON

Then, Ctrl + X --> Y --> Enter.

It should create an icon for you to launch, just search for it in Menu.

Solution 2:

Desktop, File Browser & Command Line

Personally, I have created a /home/bin directory to keep scripts for occasions like this.

$ sudo mkdir /home/bin

Just make sure that for every user the directory /home/bin is accessible:

$ sudo chmod +rx /home/bin

Furthermore the new directory should be listed as PATH="/home/bin:$PATH" in the ~/.profile file of every user or wherever PATH happens to be defined on your system.

Save below bash script as jabref in the newly created /home/bin/ directory.

#!/usr/bin/env bash
INSTALLDIR='/home/opt/jabref'

# Run the latest version.
java -jar $(ls -1v $INSTALLDIR/JabRef*.jar |tail -n 1) $@ &

The bash script should be made executable with:

$ sudo chmod +x jabref

The script will open the latest version of JabRef*.jav previously saved in /home/opt/jabref/ with any yet existing desktop launcher or any file browser integration. Simply typing jabref at the command line also works.