Results 1 to 10 of 10

Thread: set ANT location to PATH

  1. #1
    Join Date
    Apr 2009
    Location
    Annapolis, MD
    Posts
    204

    Default set ANT location to PATH

    I am trying to set the PATH so that I can use the ANT command from the console. Ant is installed in my Netbeans directory.

    /home/<username>/Netbeans-6.5.1/Java2/ant/bin

    How do I get this permanently in the PATH. I tried messingn around with etc/profile and almost screwed up my system. Is there a command line I can use to permanently keep it in profile?

    I tried this without success...
    export ANT_HOME=/home/owenc/netbeans-6.5.1/java2/ant
    export PATH=${PATH}:${ANT_HOME}/bin

  2. #2
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    27,213
    Blog Entries
    15

    Default Re: set ANT location to PATH

    Quote Originally Posted by imterpsfan2
    I am trying to set the PATH so that I can use the ANT command from the
    console. Ant is installed in my Netbeans directory.

    /home/<username>/Netbeans-6.5.1/Java2/ant/bin

    How do I get this permanently in the PATH. I tried messingn around
    with etc/profile and almost screwed up my system. Is there a command
    line I can use to permanently keep it in profile?

    I tried this without success...
    export ANT_HOME=/home/owenc/netbeans-6.5.1/java2/ant
    export PATH=${PATH}:${ANT_HOME}/bin
    Hi
    Just add it to you user profile
    Code:
    vi ~/.profile
    
    export ANT_HOME=/home/owenc/netbeans-6.5.1/java2/ant
    export PATH=$PATH:$ANT_HOME/bin
    --
    Cheers Malcolm (Linux Counter #276890)
    SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.27.29-0.1-default
    up 11 days 21:41, 3 users, load average: 2.46, 0.97, 0.45
    GPU GeForce 8600 GTS Silent - CUDA Driver Version: 190.18


  3. #3
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,384

    Default Re: set ANT location to PATH

    Here I am again

    As this is installed somewhere below your home directory (and NOT system wide) and thus only of concern to you and not to one of the other of the systems users, this is NOT to go in /etc/profile. Ths is true even if you argue that you are the only user because that is not true. One of the others you will know is root, but there are more. Just look at /etc/passwd for a list of them. You really do not want to change the PATH of root so that root will execute some binary of ANT instead of one of the same name in /sbin. That would be a major security breach.

    Code:
    export ANT_HOME=/home/owenc/netbeans-6.5.1/java2/ant
    export PATH=${PATH}:${ANT_HOME}/bin
    I do not know why all the exports are there. We need simply
    Code:
    PATH=${PATH}:/home/owenc/netbeans-6.5.1/java2/ant/bin
    You can try this and then execute one of the programs residing in
    Code:
    /home/owenc/netbeans-6.5.1/java2/ant/bin
    by just calling their name.
    When it works as desired you can make it "permanent" by adding the line at the end of the file .bashrc in your home directory.
    Henk van Velden

  4. #4
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,384

    Default Re: set ANT location to PATH

    OK putting it in .profile works also, but the export is nonsense.
    Henk van Velden

  5. #5
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    27,213
    Blog Entries
    15

    Default Re: set ANT location to PATH

    Quote Originally Posted by hcvv
    OK putting it in -.profile -works also, but the -export -is nonsense.
    Hi
    That would depend on the shell being invoked hence the use
    of .profile

    --
    Cheers Malcolm (Linux Counter #276890)
    SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.27.29-0.1-default
    up 11 days 22:30, 3 users, load average: 0.26, 0.34, 0.48
    GPU GeForce 8600 GTS Silent - CUDA Driver Version: 190.18


  6. #6
    Join Date
    Apr 2009
    Location
    Annapolis, MD
    Posts
    204

    Default Re: set ANT location to PATH

    vi ~/.profile

    That's creating a new profile? Don't I just want to add those lines to the existing profile? And I read that it's a better practice to create a profile.local and add that path explicitly there.

    I know that I will not install another version of ANT on this machine. The reason I am using the one in the Netbeans directory is that I don't want duplicate ant installations.

  7. #7
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    27,213
    Blog Entries
    15

    Default Re: set ANT location to PATH

    Quote Originally Posted by imterpsfan2
    vi ~/.profile

    That's creating a new profile? Don't I just want to add those lines to
    the existing profile? And I read that it's a better practice to create
    a profile.local and add that path explicitly there.

    I know that I will not install another version of ANT on this machine.
    The reason I am using the one in the Netbeans directory is that I don't
    want duplicate ant installations.
    Hi
    By default a ~/.profile is added the first time you login.

    Did it get deleted in error?

    If it exists you just append the lines at the bottom, else here is a
    copy of it;
    http://www.nopaste.com/p/a9P20KMOmb

    --
    Cheers Malcolm (Linux Counter #276890)
    SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.27.29-0.1-default
    up 11 days 22:58, 3 users, load average: 0.47, 0.13, 0.12
    GPU GeForce 8600 GTS Silent - CUDA Driver Version: 190.18


  8. #8
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,384

    Default Re: set ANT location to PATH

    Code:
    vi .profile
    (no need to add ~/ before it)
    will edit when .profile exists (which it should do) or create a new one (only when you write it with the :w command).

    That creating of a profile.local is for the central one (/etc/profile). Not for the .profile in your home.

    The .profile in your home is allready very "local" because it will not be overwritten updating (or installing a new) openSUSE (if you have a separate /home and leave that alone during update/install).
    Henk van Velden

  9. #9
    Join Date
    Apr 2009
    Location
    Annapolis, MD
    Posts
    204

    Default Re: set ANT location to PATH

    Ah, I realize now you meant the hidden profile in home, NOT the profile in /etc. So if I set it in profile.local, the ANT command would be available to all users? By putting in home, I'm restricting the ant command.

    Setting this in my home directory is exactly what I want. Kudos to both of you for your patience.

  10. #10
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,384

    Default Re: set ANT location to PATH

    Quote Originally Posted by imterpsfan2 View Post
    Ah, I realize now you meant the hidden profile in home, NOT the profile in /etc. So if I set it in profile.local, the ANT command would be available to all users? By putting in home, I'm restricting the ant command.

    Setting this in my home directory is exactly what I want. Kudos to both of you for your patience.
    We express ourselves very carefully. When I type .profile, I mean .profile and not profile.

    And what you say is again a misconception. Setting the PATH to point to the directory with the ANT programs in your home directory does NOT make them available to others. It only means that they are found when called by their name only instead of by a path specification. They are made "available" when others can execute them (that mean the r- and x-bits set for group and/or other on the file and all the directories leading to it), which is something completely different.

    Nevertheless, you have learned something again. Fruitfull day today.

    Edit: And about the kudus, you could click on the green rectangles in the right upper corner. Surprise!
    Henk van Velden

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •