Find the answer to your Linux question:
Results 1 to 2 of 2
My end goal: be able to use jar command from any directory i choose. I am trying to follow instructions for unzipping a war using the jar command, Code: mkdir ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2012
    Posts
    3

    Unhappy Questions about modifying bash_profile values, export, etc.


    My end goal: be able to use jar command from any directory i choose.

    I am trying to follow instructions for unzipping a war using the jar command,

    Code:
    mkdir -p /tmp/my_ear
    cd /tmp/my_ear
    jar -xvf $WEBCENTER_HOME/archive/applications/webcenter.ear
    
    mkdir war
    cd war
    jar -xvf ../spaces.war

    I have been googling all day how to update the ~/.bash_profile using export $PATH...

    Can someone please help walk me through the correct steps to do this? I am not sure if the path should point to the JRE, the JDK or both, but more importantly I just am new to modifying the .bash_profile. I have made a couple of my own aliases for jumping to commonly used directories, but that is about it so far!

    From what I have found, it looks like this will be the path I use when updating the bash_profile - how can I confirm?
    Code:
    /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/bin
    And finally this is how it is currently setup in my ~/.bash_profile:

    Code:
    PATH=$PATH:$HOME/bin
    export PATH
    
    export PATH=/u01/app/oracle/product/fmw/Oracle_WT1/instances/instance1/bin/:$PATH

    Thanks,
    s
    Last edited by sethbw; 04-20-2012 at 07:44 PM.

  2. #2
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,674
    As far as I can see, jar should be in /usr/bin which should already be in your path.

    You can view your current path by running the command
    Code:
    echo $PATH
    which on my LMDE system produces
    Code:
    /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
    You can see which version of a program is going to be run using the which command
    Code:
    which jar
    produces
    Code:
    /usr/bin/jar
    on my system.

    If the which command doesn't find the program, you can try the following
    Code:
    sudo updatedb
    locate jar
    The updatedb command can take a long time to run and needs to be run as root; if your disto doesn't use sudo then su to root first.

    If the locate command finds jar and if it installed then there is no reason it shouldn't, a more elegant solution may be to create a symlink in /usr/bin
    Code:
    sudo ln -s /usr/bin/jar /path/to/jar
    Now to answer your question regarding your .bash_profile. I think the syntax is wrong. Try

    Code:
    PATH=/u01/app/oracle/product/fmw/Oracle_WT1/instances/instance1/bin/:$PATH:$HOME/bin:/path/to/jar
    export PATH
    "I used to be with it, then they changed what it was.
    Now what was it isn't it, and what is it is weird and scary to me.
    It'll happen to you too."

    Grandpa Simpson



    The Fifth Continent

Posting Permissions

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