Thursday, September 18, 2014

Upgrading IntelliJ on Ubuntu

Whenever I receive an "upgrade to the latest version" notification from IntelliJ IDEA I usually click the "Remind Me Later" button because I always forget the steps required to make the new version work with Unity Launcher.  So today I'm going to save myself some trouble and document those steps to help streamline the process in the future.  The biggest annoyance is always in creating the Unity Launcher file for the new version, so that's what I'm going to focus on.

So here goes ...

How to upgrade to the latest version of Intellij IDEA

1. Download the latest version of IDEA


2. Extract contents to a temporary location (e.g. ~/Desktop)


3. Move the extracted idea directory to the /opt directory

$ cd ~/Desktop
$ sudo mv idea-IU-135.1230 /opt/

4. Create a new or update an existing Unity Launcher (.desktop file)
$ sudo vi /usr/share/applications/jetbrains-idea.desktop

5. If you are updating an existing .desktop file, simply replace the Icon and Exec attributes with the paths to the new logo and idea.sh script.

For example, make yours ...

[Desktop Entry]
Version=1.0
Type=Application
Name=IntelliJ IDEA
Icon=/opt/idea-IU-133.696/bin/idea.png
Exec="/opt/idea-IU-133.696/bin/idea.sh" %f
Comment=Develop with pleasure!
Categories=Development;IDE;
Terminal=false
StartupWMClass=jetbrains-idea

look like mine ...

[Desktop Entry]
Version=1.0
Type=Application
Name=IntelliJ IDEA
Icon=/opt/idea-IU-135.1230/bin/idea.png
Exec="/opt/idea-IU-135.1230/bin/idea.sh" %f
Comment=Develop with pleasure!
Categories=Development;IDE;
Terminal=false
StartupWMClass=jetbrains-idea

How to future-proof this solution

In order to make this easier in the future, I've added a symlink to the current IDEA directory (e.g. /opt/idea-IU-135.1230) so that we can simply extract the .tar.gz file contents to the /opt directory and change the symlink to point to the latest version!  So just make a simple change to the .desktop file and you'll never have to do it again.

[Desktop Entry]
Version=1.0
Type=Application
Name=IntelliJ IDEA
Icon=/opt/idea/bin/idea.png
Exec="/opt/idea/bin/idea.sh" %f
Comment=Develop with pleasure!
Categories=Development;IDE;
Terminal=false
StartupWMClass=jetbrains-idea

So whenever there's a new version you just need to download / extract the .tar.gz and update the symlink.

1. Download latest version



2. Extract contents to /opt



3. Create symlink to the latest directory

$ ln -s /opt/idea-IU-135.1230 /opt/idea

4. Boom.

1 comment:

Mike Porter said...

Thanks, I've never thought to use symlinks for the Jetbrains tools.