Ubuntu Menu Item

Has anyone managed to add a menu item for IDEA in Ubuntu?
I unpacked the tarball and I can run IDEA via idea.sh in the bin directory.

I then tried to add a launcher via:
System -> Preferences -> Main Menu: Programming -> New Item
Name = IDEA
Command = /home/myName/apps/JetBrains/idea-IU-90.193/bin/idea.sh

However, when I click on it nothing happens.
If I paste that command into a terminal IDEA launches.

Any clue to what is going on?

Comment actions Permalink

Check your environment. idea.sh needs a couple of variables (IDEA_JDK or JDK_HOME) defined to work correctly. They may be defined for your shell, but not for the X11 session. Try defining these variables in your ~/.profile script, then logging out and in again. Another option is hardcoding these variables in the idea.sh script. This is guaranteed to work, but then you have to do it every time you upgrade.

Comment actions Permalink

I hadn't thought about the difference between the shells, thanks!
I've been working on a script to install an icon in the menu automatically.
It would live in the bin directory and so far looks like this.

The problem is getting the environment variables in correctly.
I don't want to sync up my .bashrc and .profile all the time (or ever) so I thought about  creating an extra launcher script that contains the necessary paths from the current env then calls the idea.sh.
Of course the other option would be do just push these into the idea.sh
I'm not sure what is the best option.

#!/bin/bash # #Get directory that the script resides in (should be the idea bin directory) CurrentDir="$(cd "${0%/*}" 2>/dev/null; echo "$PWD")" #Create launcher with env variables in it Launcher="launcher.sh" #Check that at least one of these variables exists if [ -n "$IDEA_JDK" -o -n "$JDK_HOME" -o -n "$JAVA_HOME" ]; then     echo "#!/bin/bash" > $Launcher     if [ -n "$IDEA_JDK" ]; then       echo export IDEA_JDK=$IDEA_JDK >> $Launcher     fi     if [ -n "$JDK_HOME" ]; then       echo export JDK_HOME=$JDK_HOME >> $Launcher     fi     if [ -n "$JAVA_HOME" ]; then         if [ -z "$JDK_HOME" ]; then                     echo export JDK_HOME=$JAVA_HOME >> $Launcher               fi         echo export JAVA_HOME=$JAVA_HOME >> $Launcher     fi     echo "exec $CurrentDir/idea.sh" >> $Launcher     chmod +x $Launcher else     echo "No JDK found to run IDEA. Please validate either IDEA_JDK or JDK_HOME points to a valid JDK installation"     exit 0 fi #Create a shortcut in the Programming Menu FileName="/usr/share/applications/idea.desktop" echo "[Desktop Entry]" |sudo tee $FileName echo "Encoding=UTF-8" |sudo tee -a $FileName echo "Name=Intellij IDEA" |sudo tee -a $FileName echo "Comment=Develop With Pleasure!" |sudo tee -a $FileName echo "Categories=GNOME;Application;Development;" |sudo tee -a $FileName echo "Exec=$CurrentDir/$Launcher" |sudo tee -a $FileName echo "Icon=$CurrentDir/idea128.png" |sudo tee -a $FileName echo "Terminal=false" |sudo tee -a $FileName echo "Type=Application" |sudo tee -a $FileName

Comment actions Permalink

Remember that bash also reads your ~/.profile, so you can move everything that's currently in your ~/.bashrc to ~/.profile, unless it's something that actually should only be defined for interactive bash shells.


Please sign in to leave a comment.