LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Questions about modifying bash_profile values, export, etc. (https://www.linuxquestions.org/questions/linux-newbie-8/questions-about-modifying-bash_profile-values-export-etc-940894/)

sethbw 04-20-2012 02:17 PM

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

suicidaleggroll 04-20-2012 02:31 PM

Quote:

Originally Posted by sethbw (Post 4658631)
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

Type the full path and see if it works, IE:
Code:

/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/bin/jre
If it works, then that's the right path.

Quote:

Originally Posted by sethbw (Post 4658631)
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


Change your PATH=$PATH:$HOME/bin line to be:
Code:

PATH=$PATH:$HOME/bin:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/bin

sethbw 04-20-2012 02:47 PM

aaahhhahahahaa i love the name :) thanks suicidaleggroll!

SO.. it still does not work... do I need to reboot the server or re login for the updated path to work?

I did:

nano ~/.bash_profile

updated the line per your advice

exit & saved

confirmed it was changed

went back to the directory i want to unzip the jar into and tried:
jar -xvf /u01/app/oracle/product/fmw/Oracle_WC1/archives/applications/webcenter.ear

but got this error:
-bash: jar: command not found

suicidaleggroll 04-20-2012 02:48 PM

You need to either log out and back in, or source the file in order for the changes to take effect:
Code:

source ~/.bash_profile

sethbw 04-20-2012 02:51 PM

Quote:

[webcenter@mspcollab11 my_ear]$ source ~/.bash_profile
[webcenter@mspcollab11 my_ear]$ jar -xvf /u01/app/oracle/product/fmw/Oracle_WC1/archives/applications/webcenter.ear
-bash: jar: command not found
[webcenter@mspcollab11 my_ear]$

:{:{:{

suicidaleggroll 04-20-2012 02:56 PM

What's the result of "echo $PATH"?

sethbw 04-20-2012 02:58 PM

How do I tell?


Quote:

[webcenter@mspcollab11 my_ear]$ echo $PATH
/u01/app/oracle/product/fmw/Oracle_WT1/instances/instance1/bin/:/u01/app/oracle/product/fmw/Oracle_WT1/instances/instance1/bin/:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/webcenter/bin:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/bin:/home/webcenter/bin:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/bin
[webcenter@mspcollab11 my_ear]$
echo $SHELL i get: /bin/bash

suicidaleggroll 04-20-2012 03:01 PM

Well your path has been modified correctly, if the program is there it should be running it. Make sure the jar command is located there by running:

Code:

ls -l /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/bin

and

/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/bin/jar


schneidz 04-20-2012 03:02 PM

what does ls -l /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/bin yeild ?

sethbw 04-20-2012 03:03 PM

would it be a file literally called "jar" in that directory?



Quote:

[webcenter@mspcollab11 my_ear]$ ls -l /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/bin
total 564
-rwxr-xr-x 1 root root 42248 Jun 3 2011 java
-rwxr-xr-x 1 root root 43552 Jun 3 2011 keytool
-rwxr-xr-x 1 root root 43624 Jun 3 2011 orbd
-rwxr-xr-x 1 root root 43584 Jun 3 2011 pack200
-rwxr-xr-x 1 root root 44096 Jun 3 2011 policytool
-rwxr-xr-x 1 root root 43544 Jun 3 2011 rmid
-rwxr-xr-x 1 root root 43552 Jun 3 2011 rmiregistry
-rwxr-xr-x 1 root root 43552 Jun 3 2011 servertool
-rwxr-xr-x 1 root root 43632 Jun 3 2011 tnameserv
-rwxr-xr-x 1 root root 125568 Jun 3 2011 unpack200
[webcenter@mspcollab11 my_ear]$

suicidaleggroll 04-20-2012 03:04 PM

Quote:

Originally Posted by sethbw (Post 4658681)
would it be a file literally called "jar" in that directory?

Yes. It looks like from your "ls" that there is no jar in that directory, which is why it can't find it. I've never used any "jar" command before, but I have run into java .jar files before. Usually in those cases I run them with "java -jar file.jar". I don't know if this has anything to do with what you're trying though.

sethbw 04-20-2012 03:05 PM

Well now I just feel stupid. I guess the trick now is finding that jar! Thanks guys.

I'm trying to locate it, using locate or find, but I don't want to return a list of .jar files... and there are a lot!

sethbw 04-20-2012 03:06 PM

Nm I used this:

find / -name jar


Found it: /u01/app/oracle/product/fmw/Oracle_WT1/jdk/bin/jar

suicidaleggroll 04-20-2012 03:08 PM

Quote:

Originally Posted by sethbw (Post 4658686)
Nm I used this:

find / -name jar


Found it: /u01/app/oracle/product/fmw/Oracle_WT1/jdk/bin/jar

In that case, just swap out the "/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/bin" in your PATH in ~/.bash_profile with the directory found above, source it, and then see if it works.

sethbw 04-20-2012 03:11 PM

It worked :) You rock!


All times are GMT -5. The time now is 10:40 PM.