First of all, you don't want to do gradle="..."
. That simply creates a variable called gradle
and is irrelevant (unless that variable is somehow used by gradle
but you haven't said so). What you want to do is add the directory containing the gradle
executable to the list of directories your system searches through when trying to find programs to run. This is what the PATH
variable does.
It is also important not to overwrite the existing contents of PATH
. So, to add foo
to the PATH
, you do:
PATH:"$PATH":foo
And not
PATH="foo"
The latter will remove everything from PATH
and replace it with foo
alone.
So, combining all this, you want to add the following lines to your ~/.profile
(or ~/.bash_profile
if that exists, but not to your ~/.bashrc
):
PATH:"$PATH:$HOME/sanctus/Documents/Development/gradle-2.2/bin"
Why ~/.profile
or ~/.bash_profile
and not ~/.bashrc
? First of all, because that's what profile is for. More importantly, ~/.bashrc
is read each time you start a new shell. So, for example, each time you open a new terminal. Setting environmental variables that only need to be set once in that file, makes them be reset each time you open a terminal and that's just needless overhead.
Additionally, settings in ~/.bashrc
only affect programs launched from the commandline. If you launch something using the GUI ( a menu entry or a .desktop
file, for example) those variables will not be available there.
In many systems, including Ubuntu, ~/.profile
is read when you log in graphically. Variables set in that file will therefore be available to GUI programs as well. Also, setting these variables in ~/.profile
is preferred since that file is only read once: at login.
Additionally, this will work even if you change your shell to something other than bash, since ~/.profile
is read by many of the most popular shells.
Important : If a ~/.bash_profile
exists, that will be read instead of ~/.profile
. So, if you do have such a file, use that one instead. My recommendation is, if you have a ~/.bash_profile
, to simply delete it and add anything that was there to your standard ~/.profile
.
Best Answer
Honestly the best way to use an icon in a launcher is to make sure the icon file is in the icon search path. Referring to the freedesktop.org icon directory scheme and base directory definitions, icons should be searched for in at least the following directories on Ubuntu systems:
$HOME/.icons
$HOME/.local/share/icons
/usr/local/share/icons
/usr/share/icons
/usr/share/pixmaps
So if you want to use your own icon and do not have root privileges, install the icon into either
$HOME/.icons
or$HOME/.local/share/icons
. Using the latter, you can even mimic the system icon directory structure with multi-resolution icons using the same base name under directories like$HOME/.local/share/icons/hicolor/48x48/apps
and$HOME/.local/share/icons/hicolor/256x256/apps
.If the icon is in one of these searchable directories, you can simply use
Icon=myapp
in the.desktop
file.