13

I tried running "Create Desktop Entry" both from "Tools" in main menu and "Configure" from the splash screen. It shows

Desktop Entry Created
You may now exit IDEA and start it from the system menu (restart a session if a new entry seem not to appear).

but after closing IDEA (without manually locking the icon to launcher), the icon is also removed. I have deleted the desktop entry under ~/.local/share/applications according to this thread Stack Overflow: Intellij launcher doesn't work on unity?

Then I tried

chmod 777 /usr/share/applications/jetbrains-idea.desktop

and dragged it to launcher, which still doesn't work.

JAVA_HOME and PATH are both set up correctly.

5
  • what command should be run by the launcher?
    – Tim
    May 1 '16 at 23:55
  • Did you check after logging out and logging in again. Sometimes unity icon cache is updated after logging out. May 2 '16 at 18:55
  • Make backup ~/.config folder cp ~/.config ~/.config-backup and delete rm -rf ~/.config folder. After this make reboot.
    – Gen
    May 3 '16 at 6:15
  • May I ask, did you run the bin/idea.sh as root with sudo ? Because that does create a root-owned .desktop file , and you can't drag those to the launcher May 3 '16 at 6:32
  • @Serg no I didn't
    – Lixu
    May 3 '16 at 19:25
17
+50

There is no option as of right now for automatic pinning of the .desktop file to the launcher of an application that was just installed. It does not just include IntelliJ but many other applications.

Technically speaking , there are ways to append an icon to the list of icons on the launcher , however most developers don't use it and leave that option up to the user. Hence you have to manually pin the Launcher icon. Otherwise, once the program exits - the icon disappears from launcher, which is the proper behavior of any app that is not on the list of the launcher favorites.

As for the .desktop file itself - it is created.

enter image description here

Checking only the Create a desktop entry option creates the file in ~/.local/share/applications/ folder, which is typically where the launcher entries for unknown or user-specific apps go.

To confirm that , I've ran this after installation:

$ ls ~/.local/share/applications | grep idea
jetbrains-idea-ce.desktop

Checking For all users option will create /usr/share/applications/jetbrains-idea-ce.desktop, since the /usr/share/applications directory is available globally to all users.

Either of these is what you want, and they can be pinned to the launcher simply by dragging them from file manager or dash to the launcher. NOTE: the bin/idea.sh must be ran as your regular user - otherwise if you run it as root, the .desktop file will be root owned, hence you cannot drag that to the launcher. If that's the case, you can always sudo chown $USER:$USER /path/to/jetbrains-idea-ce.desktop

You can always copy either of those to Desktop if that's what you want, but .desktop files aren't literally supposed to be on the desktop.

As a last resort, you can always manually create a .desktop file.

In my example, that would be

[Desktop Entry]
Type=Application
Terminal=false
Exec=/bin/sh /home/xieerqi/intellij/idea-IC-145.597.3/bin/idea.sh
Name=Intellij
Icon=/home/xieerqi/intellij/idea-IC-145.597.3/bin/idea.png

Notice , that this is different from the example in the link you provided . The #!/usr/bin/env xdg-open is unnecessary and Exec line actually runs /bin/sh and the idea.sh as parameter to it. Note that this .desktop file needs to have executable permissions, otherwise you will receive a warning "Untrusted application"

2
  • I changed the content of the generated .desktop file as you said, dragged it to launcher, clicked on it, nothing happened.
    – Lixu
    May 4 '16 at 2:13
  • Please add this: You need to remove this folder: ~/.local/share/JetBrains/ to open the Installation Wizard again.
    – Grisotto
    Dec 18 '18 at 18:17
4

I was finally able to fix this by myself.

  1. Make sure JAVA_HOME is set correctly in the profile of your shell. For instance, I'm using zsh so I have to add export JAVA_HOME=/..... in ~/.zshrc

  2. If you specified any jar file to run as javaagent in idea.vmoptions, make sure to specify its full path name.

  3. Simply create .desktop file from IDEA or manually and point Exec parameter to the full path of your idea.sh file. Then drag it to the launcher. Works fine.

2

Let us create and install a new desktop file idea.desktop which is a shortcut file for IntelliJ IDEA.

$ vi ~/idea.desktop

Type the following in the shortcut file idea.desktop using the editor:

[Desktop Entry]                                                                 
Encoding=UTF-8
Name=IntelliJ IDEA
Comment=IntelliJ IDEA
Exec=/opt/idea/bin/idea.sh
Icon=/opt/idea/bin/idea.png
Terminal=false
StartupNotify=true
Type=Application
StartupWMClass=IntelliJ IDEA

Now, run the following command to install idea.desktop file in /usr/share/applications/ directory:

$ sudo desktop-file-install idea.desktop

Never directly copy shortcut file into /usr/share/applications/ directory. If there are any errors in shortcut file such as idea.desktop who is going to catch them? That is why we install using above command rather than cp command. Command desktop-file-install is capable of catching errors!

In order to complete this answer, let us create a symlink in /usr/local/bin directory:

$ cd /usr/local/bin/
$ sudo ln -s /opt/idea/bin/

Alternatively, as the IntelliJ IDEA executable binary is located under /opt/idea/bin, we can also add its parent directory to our $PATH so that we can launch the program without specifying the absolute path to the binary file.

$ vi ~/.bashrc
export PATH="$PATH:/opt/idea/bin"

I had similar shortcut issues while installing Netbeans 10.0, please refer After installation, Netbeans 10.0 won't run from Ubuntu 18.04 desktop

1

simply u can:

  1. run ./idea.sh again from terminal (like when u were installing but u won't install)
  2. then it will open the application, press on "configure".
  3. press create desktop entry :D
1
  • 1
    this one surely worked for me!
    – Joy Grewal
    Jun 24 '20 at 9:48
0

May be I'm too late by anyways. Idea 19.1 is creating entry which is in the file jetbrains-idea.desktop. when I hit launcher and try to find via typing idea it's not showing. Once I've made a copy of a file:

cp /usr/share/applications/jetbrains-idea.desktop /usr/share/applications/idea.desktop

it has started showing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.