Path Environment ~/.profile for android SDK

Forum rules
Before you post please read how to get help

Path Environment ~/.profile for android SDK

Postby canado on Fri Dec 14, 2012 10:23 am

Hi everyone

I'm trying to set my environment path in order to use the android SDK.
I've been trying to set the ~/.profile file with a lot of different possibilities + doing source ~/.profile + login in and out
all without success

my SDK is located in a directory named eclipse and that directory is located in home.

here is my file
Code: Select all
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
   . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH:/home/eclipse/sdk/tools:/home/eclipse/sdk/platform-tools"
fi




any help would be appreciated, thanks a lot

for info I tried
:/home/eclipse/sdk/tools
:$HOME/eclipse/sdk/tools
:$HOME/home/eclipse/sdk/tools
:~/home/eclipse/sdk/tools
:~/eclipse/sdk/tools
canado
Level 1
Level 1
 
Posts: 3
Joined: Fri Dec 14, 2012 10:15 am

Linux Mint is funded by ads and donations.
 

Re: Path Environment ~/.profile for android SDK

Postby xenopeek on Fri Dec 14, 2012 10:41 am

Ahum. Perhaps read the lines surrounding the bit where you added your path (I'm assuming you can program, why else would you mess around with Android SDK :D). Highlighted in red the clue of the day, namely that the directory "bin" doesn't exist on a default installation of Linux Mint. This bit of code in the .profile file is there to automatically to your PATH the directory "bin", if you have created that directory in your home directory. Else it is of course skipped.
canado wrote:# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH:/home/eclipse/sdk/tools:/home/eclipse/sdk/platform-tools"
fi

I suggest you revert that piece of code and don't touch code in your .profile, but only add lines at the end.

Now you are being very unclear with the next bit.
canado wrote:my SDK is located in a directory named eclipse and that directory is located in home.

Have you the directory eclipse in your home directory (e.g., in /home/canado/eclipse), or in the home directory (i.e., in /home/eclipse). Check with your file manager where you have this directory, because you need to be exact. I hope it is in your home directory (e.g., in /home/canado/eclipse) and will proceed with that.

So to revert the changes you made and add the bits needed, this is what the lines I quoted above should be replaced with:
Code: Select all
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# add Android SDK to PATH
PATH="$HOME/eclipse/sdk/tools:$HOME/eclipse/sdk/platform-tools:$PATH"
User avatar
xenopeek
Level 21
Level 21
 
Posts: 15256
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Path Environment ~/.profile for android SDK

Postby canado on Fri Dec 14, 2012 11:06 am

Hi Vincent

Thanks for your reply

- Yes the bin directory exist so the path is applied (I tested it by copying an executable file inside bin)
- I didn't know I could chain the path, meaning I could do

PATH="$HOME/bin" and few lines later PATH="something else" and that all the parameters would be merged.

And to be more precise with my previous post, yes the sdk directory is in /home/canado/eclipse

I will try your line once home.
Thanks a lot for this quick reply. It's appreciated : )
canado
Level 1
Level 1
 
Posts: 3
Joined: Fri Dec 14, 2012 10:15 am

Re: Path Environment ~/.profile for android SDK

Postby canado on Fri Dec 14, 2012 11:09 am

Before I forget

In order to update the path, what is the procedure?
Should I do a source ~/.profile ?
Should I log out and then log in ?
Should I restart ?

Thanks
canado
Level 1
Level 1
 
Posts: 3
Joined: Fri Dec 14, 2012 10:15 am

Re: Path Environment ~/.profile for android SDK

Postby xenopeek on Fri Dec 14, 2012 12:26 pm

Log out and log in to activate changes is the most fool-proof way. And yes you can have multiple PATH assignments, as long as you include $PATH in each it will just keep adding and expanding PATH :wink:

I hope it works as I have shown, that should be correct given your clarifications.
User avatar
xenopeek
Level 21
Level 21
 
Posts: 15256
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands


Return to Scripts & Bash

Who is online

Users browsing this forum: No registered users and 2 guests