Announcement

Collapse
No announcement yet.

Setting PATH=$PATH....need help understanding.

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

    Setting PATH=$PATH....need help understanding.

    I am installing a program called jLog which uses Java to run in Linux. The jLog installation instructions tell me to do the following:

    # Unless already installed, please install the Java Runtime Environment before installing the jLog application.

    # Log in as the preferred user and download the installer program that corresponds to the selected version of jLog.

    # Make sure that the logged in user can reach the Java (JRE) previously installed by opening a Terminal window ("shell") and typing:

    $ echo $PATH

    Inspect the output. If Java is not found in the PATH, please enter (assuming that the Java JRE was placed in: '/usr/java/', substitute if different):


    $ PATH=$PATH:/usr/java/jre1.6.0_06/bin; export PATH
    $ echo $PATH


    Please verify that Java is found in the PATH by re-entering 'echo $PATH'
    I have followed these instructions carefully but I am not finding success. Below is my output. Note ...I installed Java in my home directory of /mrmsu/Java.
    mrmsu@closet:~$ sudo PATH=$PATH:Java/jre1.6.0_06/bin;export PATH
    usage: sudo -h | -K | -k | -L | -l | -V | -v
    usage: sudo [-bEHPS] [-p prompt] [-u username|#uid] [VAR=value]
    {-i | -s | <command>}
    usage: sudo -e [-S] [-p prompt] [-u username|#uid] file ...
    mrmsu@closet:~$ sudo PATH=.:$PATH:Java/jre1.6.0_06/bin;export PATH
    usage: sudo -h | -K | -k | -L | -l | -V | -v
    usage: sudo [-bEHPS] [-p prompt] [-u username|#uid] [VAR=value]
    {-i | -s | <command>}
    usage: sudo -e [-S] [-p prompt] [-u username|#uid] file ...
    mrmsu@closet:~$ sudo PATH=$PATH:~Java/jre1.6.0_06/bin;export PATH
    usage: sudo -h | -K | -k | -L | -l | -V | -v
    usage: sudo [-bEHPS] [-p prompt] [-u username|#uid] [VAR=value]
    {-i | -s | <command>}
    usage: sudo -e [-S] [-p prompt] [-u username|#uid] file ..
    Obviously, I'm not able to add this path as needed. What am I doing wrong?

    Mike
    sudo make me rich<br /><br />Kubuntu Gutsy 7.10<br />KDE 3.5<br />Compaq Presario 5000<br />Intel Celeron 1.2 Ghz<br />512 Ram, Riva TNT2 Video Card<br />All the above hardware is 7 year old junk but<br />Linux runs great on it.&nbsp; :&gt<br />Ham Radio Rules

    #2
    Re: Setting PATH=$PATH....need help understanding.

    Why are you prefacing the instructions statement for $PATH with sudo? The instructions don't tell you to use sudo.

    Three things wrong with your command:
    sudo PATH=$PATH:Java/jre1.6.0_06/bin;export PATH
    First, replace sudo with echo (as the instructions state)
    Second, you aren't referencing the location in your home directory correctly.
    Third, you need to include a space after /bin; and export.

    So, retry the command as:
    Code:
    echo PATH=$PATH:~/mrmsu/Java/jre1.6.0_06/bin; export PATH
    Windows no longer obstructs my view.
    Using Kubuntu Linux since March 23, 2007.
    "It is a capital mistake to theorize before one has data." - Sherlock Holmes

    Comment


      #3
      Re: Setting PATH=$PATH....need help understanding.

      Originally posted by Snowhog
      So, retry the command as:
      Code:
      echo PATH=$PATH:~/mrmsu/Java/jre1.6.0_06/bin; export PATH
      No echo needed here, just
      Code:
      PATH=$PATH:~/mrmsu/Java/jre1.6.0_06/bin; export PATH
      will set the path, echo can be used to display the $PATH variable.

      Comment


        #4
        Re: Setting PATH=$PATH....need help understanding.

        Okay...that worked. However, I managed to enter a path name incorrectly so there is now a location shown by "echo $PATH" that I want to remove. How do I remove it?

        Thanks!

        Mike
        sudo make me rich<br /><br />Kubuntu Gutsy 7.10<br />KDE 3.5<br />Compaq Presario 5000<br />Intel Celeron 1.2 Ghz<br />512 Ram, Riva TNT2 Video Card<br />All the above hardware is 7 year old junk but<br />Linux runs great on it.&nbsp; :&gt<br />Ham Radio Rules

        Comment


          #5
          Re: Setting PATH=$PATH....need help understanding.

          Assuming that you typed the PATH command in a terminal, the new PATH is only valid inside the terminal. I'd just close the terminal, open a new one and try again.
          Registered Linux User: #281828 | Kubuntu User: #22280

          Kubuntu 18.04 LTS
          Dell Precision Workstation T5500 (Xeon @ 2.13GHz x 2 / 12 GB RAM)

          Comment


            #6
            Re: Setting PATH=$PATH....need help understanding.

            Originally posted by daihard
            Assuming that you typed the PATH command in a terminal, the new PATH is only valid inside the terminal. I'd just close the terminal, open a new one and try again.
            Temporary? Well, that may answer why the program is not running correctly. How does one make a permanent path change?
            sudo make me rich<br /><br />Kubuntu Gutsy 7.10<br />KDE 3.5<br />Compaq Presario 5000<br />Intel Celeron 1.2 Ghz<br />512 Ram, Riva TNT2 Video Card<br />All the above hardware is 7 year old junk but<br />Linux runs great on it.&nbsp; :&gt<br />Ham Radio Rules

            Comment


              #7
              Re: Setting PATH=$PATH....need help understanding.

              To set the path 'globally' you can use the env command from the CLI. Open a console and type:
              Code:
              env
              and you will see all the globally set environment variables, including PATH.

              So, in the console, if you type:
              Code:
              env PATH=$PATH:~/mrmsu/Java/jre1.6.0_06/bin
              This should do it for you. (execution by sudo may be required)
              Windows no longer obstructs my view.
              Using Kubuntu Linux since March 23, 2007.
              "It is a capital mistake to theorize before one has data." - Sherlock Holmes

              Comment


                #8
                Re: Setting PATH=$PATH....need help understanding.

                Originally posted by Snowhog
                So, in the console, if you type:
                Code:
                env PATH=$PATH:~/mrmsu/Java/jre1.6.0_06/bin
                This should do it for you. (execution by sudo may be required)
                You sure that works? Not to chat back, but I've always thought adding the "export VARIABLE" statement in one of the startup files (~/.bash_profile or ~/.profile) would be the way to set environment variables globally.
                Registered Linux User: #281828 | Kubuntu User: #22280

                Kubuntu 18.04 LTS
                Dell Precision Workstation T5500 (Xeon @ 2.13GHz x 2 / 12 GB RAM)

                Comment


                  #9
                  Re: Setting PATH=$PATH....need help understanding.

                  Don't mind the 'chat back' at all. This is a friendly Forum.

                  "You sure that works?" No. Re-reading the man(ual) for env - which isn't very large - I see that env allows you to run a program in a modified environment, which I (now) take to mean 'temporarily modified.' Hmm.

                  My Learning the bash Shell 2nd Edition, published by O'Reilly, does describe the process of exporting as the means of creating new or modifying existing environment variables. So, the original correction made by kubicle:
                  PATH=$PATH:~/mrmsu/Java/jre1.6.0_06/bin; export PATH
                  should be all that is required.
                  Windows no longer obstructs my view.
                  Using Kubuntu Linux since March 23, 2007.
                  "It is a capital mistake to theorize before one has data." - Sherlock Holmes

                  Comment


                    #10
                    Re: Setting PATH=$PATH....need help understanding.

                    I initially followed Kubical's instructions but the path did not "stick". It was temporary. This is what Echo Path gives me after a fresh reboot:

                    mrmsu@closet:~$ echo $PATH
                    /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
                    Notice that the path I set is no longer present. WAhhaahhhahhhaahhhhhaaa!

                    sudo make me rich<br /><br />Kubuntu Gutsy 7.10<br />KDE 3.5<br />Compaq Presario 5000<br />Intel Celeron 1.2 Ghz<br />512 Ram, Riva TNT2 Video Card<br />All the above hardware is 7 year old junk but<br />Linux runs great on it.&nbsp; :&gt<br />Ham Radio Rules

                    Comment


                      #11
                      Re: Setting PATH=$PATH....need help understanding.

                      You can set a PATH 'permanently' for a specific user by adding the modified PATH to bash startup files (if you're using bash)...if you look at ~/.bash_profile, there already is a PATH modification in there to add ~/bin to PATH if that directory exists. You can do a similar addition for your modified PATH.

                      That being said, if you install java from the repositories (instead of manually installing it to your home folder), you shouldn't have to modify your path (/usr/bin/java will link to /etc/alternatives/java which links further to the java path you specify with 'sudo update-alternatives --config java'...which means every program that wants java should be able to find it)...of course you may have a valid reason to install java in your home folder, in which case stick with PATH modification.

                      Comment


                        #12
                        Re: Setting PATH=$PATH....need help understanding.

                        Oh man, that hurts my Noob head to read that. Basically, I'm trying to follow these directions:

                        http://jlog.org/java_lin.htm

                        which tell me to install the latest and greatest version of Java Runtime Environment. I'm not at my Linux machine so I'm not sure if the version of Java in the repository is the latest and greatest. Do you? I want to keep this as simple as possible.
                        sudo make me rich<br /><br />Kubuntu Gutsy 7.10<br />KDE 3.5<br />Compaq Presario 5000<br />Intel Celeron 1.2 Ghz<br />512 Ram, Riva TNT2 Video Card<br />All the above hardware is 7 year old junk but<br />Linux runs great on it.&nbsp; :&gt<br />Ham Radio Rules

                        Comment


                          #13
                          Re: Setting PATH=$PATH....need help understanding.

                          Originally posted by kubicle
                          ...if you look at ~/.bash_profile, there already is a PATH modification in there to add ~/bin to PATH if that directory exists. You can do a similar addition for your modified PATH.
                          The problem here, is that the file .bash_profile does not exist in the user's home directory (at least, there isn't one in mine!). The .bash* files that do exist are .bash_history, .bash_logout, and .bashrc (and in my case, .bash_aliases which I created).

                          Thoughts?
                          Windows no longer obstructs my view.
                          Using Kubuntu Linux since March 23, 2007.
                          "It is a capital mistake to theorize before one has data." - Sherlock Holmes

                          Comment


                            #14
                            Re: Setting PATH=$PATH....need help understanding.

                            Originally posted by Snowhog
                            The problem here, is that the file .bash_profile does not exist in the user's home directory (at least, there isn't one in mine!). The .bash* files that do exist are .bash_history, .bash_logout, and .bashrc (and in my case, .bash_aliases which I created).
                            You can use ~/.profile instead. That file does exist on Kubuntu. Bash reads it in as long as ~/.bash_profile is not present.

                            I find it odd that Kubuntu decided to use ~/.profile instead of ~/.bash_profile. While ~/.profile is more flexible (i.e. other shells such as sh and ksh also read it in), I'd imagine most Kubuntu users will stick with bash. Those who know to switch to another shell would know to rename the startup file, too.
                            Registered Linux User: #281828 | Kubuntu User: #22280

                            Kubuntu 18.04 LTS
                            Dell Precision Workstation T5500 (Xeon @ 2.13GHz x 2 / 12 GB RAM)

                            Comment


                              #15
                              Re: Setting PATH=$PATH....need help understanding.

                              Originally posted by Snowhog
                              The problem here, is that the file .bash_profile does not exist in the user's home directory (at least, there isn't one in mine!). The .bash* files that do exist are .bash_history, .bash_logout, and .bashrc (and in my case, .bash_aliases which I created).
                              Ah yes, (k)ubuntu changed from using ~/.bash_profile to ~/.profile in hardy (or possibly gutsy, can't remember for sure), probably aiming for a bit more universality in shell setups. This is not a dramatic change as bash will read ~/.profile (if ~/.bash_profile or ~/.bash_login don't exist) as mentioned by daihard.

                              Of course it 'may' cause some issues if you put bashisms in ~/.profile that other shells might not understand.

                              Originally posted by mechanism
                              which tell me to install the latest and greatest version of Java Runtime Environment. I'm not at my Linux machine so I'm not sure if the version of Java in the repository is the latest and greatest.
                              The Java version offered in the repos depends on which version of kubuntu you're running. The Java version in Hardy is 6.06, which I believe to be the latest (though not necessarily the greatest ) released version

                              Comment

                              Working...
                              X