Announcement

Collapse
No announcement yet.

Path variable

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Path variable

    Hello,

    I have installed java into my system and I want to add it in the path variable. I used the command

    PATH=/mydir/jdk1.6.0/bin/:$PATH

    My problem is that kubuntu already has the java command, so when I write "java" it uses the default version and not the one I have installed.

    What could I do to change that?

    Thanks in advance!

    #2
    Re: Path variable

    Originally posted by esogos
    What could I do to change that?
    - Brave would be to replace the "original" binary with a ]
    sudo cp /usr/bin/java /usr/bin/java.orig
    sudo ln -s /mydir/jdk1.6.0/bin/java /usr/bin/java
    [/code]

    - Clever would be to create an alias (e.g. "myjava") to access the new one:

    Code:
    # to be added to </etc/bashrc> or the like
    alias myjava='/mydir/jdk1.6.0/bin/java'
    HTH
    Birdy (aka littleDrHouse)

    Comment


      #3
      Re: Path variable

      Thanks! I chose to be brave

      One last thing, as root I added some directories to the path variable, but when I switched to a simple user it was as if the path was not updated there, too. Does each user have his own PATH, or is it something else?

      Comment


        #4
        Re: Path variable

        Another option is this command:

        Code:
        sudo update-alternatives --config java
        Jucato&#39;s Data Core

        Comment


          #5
          Re: Path variable

          Originally posted by esogos
          Thanks! I chose to be brave
          One down, nine to go :P

          Originally posted by esogos
          Does each user have his own PATH, or is it something else?
          "Yes" to both questions there is a user-specific "lower level" (e.g. ~/.bashrc) as well as a system-wide "higher level" (e.g. /etc/bashrc) - in which (surprise, surprise ...) only from the latter one you will be able to take influence on what all user (incl. root) are going to experience - further reading.

          HTH
          Birdy

          --

          Postscript: reference updated

          Comment

          Working...
          X