Skip to content

Instantly share code, notes, and snippets.

@jGleitz
Last active February 7, 2016 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jGleitz/cf9df461698f4e133cef to your computer and use it in GitHub Desktop.
Save jGleitz/cf9df461698f4e133cef to your computer and use it in GitHub Desktop.
[Instructions] URL Handler for opening Eclipse

This will explain how to register a custom url handler to open files in Eclipse at a specific line number on Linux. After performing these instructions, you will be able to open urls of the form

openineclipse://open?url=$path-to-file?line=$linenumber

The instructions were tested on Ubuntu 15.10 but should work on most Gnome based distributions.

  1. Install xdotool
sudo apt-get install xdotool
  1. Download the shell script. Save it somewhere and make it executable (chmod +x). Let’s say we save it to ~/.scripst/open-in-eclipse.sh.
  2. Adapt the configuration constants in the scripst. You’ll need to at least modify $ECLIPSE.
  3. Download the .desktop file and save it to ~/.local/share/applications/open-in-eclipse.desktop. Make it executable.
  4. Adapt the path to the shell sript in the desktop file (line 4)
  5. register the url handler:
sudo update-desktop-database
xdg-mime default open-in-eclipse.desktop x-scheme-handler/openineclipse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment