18

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.

a06e
  • 12,613
  • 25
  • 66
  • 102
  • 2
    The JabRef team is working in on getting a snap running for JabRef. See [pull request](https://github.com/JabRef/jabref/pull/2345#issuecomment-320210962). Installation: `sudo snap install jabref --edge --devmode`. Update: `sudo snap refresh jabref --edge --devmode`. There will be stable version as soon as a) JabRef 4.0 is released and b) this snap is considered stable. Any feedback and support is appreciated. – koppor Aug 07 '17 at 19:23
  • 1
    @koppor Good to know. Hope it gets out soon. – a06e Aug 07 '17 at 19:25

2 Answers2

18

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.

Raphael
  • 7,985
  • 5
  • 34
  • 51
  • Where can I get Jabref's icon? – a06e Jan 15 '16 at 13:03
  • Here are some [examples](https://www.google.com/search?q=jabref+icon&prmd=ivns&tbm=isch&tbo=u&source=univ&sa=X&ved=0ahUKEwjf2fT68KvKAhUFC44KHRr8CUMQsAQICw) – Raphael Jan 15 '16 at 13:07
  • Download an ico from there and save it to any folder. Its recommended to keep the icon anywhere except `/media/*` folder. – Raphael Jan 15 '16 at 13:10
  • Yes it still works. If its gone, try checking the location. First run it from terminal to check if the command still works – Raphael Jan 31 '16 at 17:05
  • OK! Glad it worked – Raphael Jan 31 '16 at 17:44
  • 2
    What if I want to run a command like $ > jabref ? – lesolorzanov Nov 14 '16 at 19:21
  • 1
    Nice answer, and I suceeded in creating my launcher icon. Nevertheless I still have two problems: first, unlike other icons, I need to __double__-click it, rather than simply clicking once to have JabRef open. Secondly, JabRef still does not apply in the "Open With" menu, and I do not know how to tell my system to use it regularly to open .bib files. – Filippo Alberto Edoardo Jul 18 '17 at 05:21
  • @ZloySmiertniy I had exactly the same concern. Please, review [my answer](https://askubuntu.com/a/1068956/164341) about how I solved this elegantly for both the desktop as the command line. – Serge Stroobandt Aug 25 '18 at 21:04
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.

Serge Stroobandt
  • 4,838
  • 1
  • 45
  • 58