Add to PATH (bash) for All Users (Suse)
I tried looking this one up on the net and am so far confused. I will continue looking.
In particular, I just installed the jdk-6u7 rpm, but the path is still pointing to the old 1.4.2 (at least when I run java -version) it still tells me that version number. I want to find where the path info is for that and fix it. |
By the way, I should add that there is no /etc/profile file there is an /etc/profile.d directory
Err... I take that back. Maybe I mistyped the word last time. I probably got this now. Sorry to junk up the page with another post. EDIT: Great... a new problem. I have automatic updates configured, but this file as marked as a "do not change" because updates may overwrite it. But how else can I set the path permanently for all users on the system? |
The path gets set in system profile file
to know where the path is set, may be long, but u can use bash -x to trace through the commands and find out where the path is being set. This is for bash shell only and in case of other shells appropriate command must be used. |
Quote:
I just tried to dump that in a file using bash -x > zpath.txt and now everythign is acting crazy |
pwd tells me I am in
+ pwd I think it's letting me add things to the path but it looks like I'm at a prompt. |
I'm not doing anything else until I understand what's going on before I break something.
EDIT Well, I just logged out and back in. That was screwy as hell though. So I guess I have no other options but to edit the /etc/profile file even if the Suse updater is going to kill it now and then? |
I'm completely stuck here.
I can't even FIND the old Java 1.4.2 installation. And I can't find any file that specified a path to it (or any other version of Java). I really need to get this done by Sunday night :) Your help is as always greatly appreciated! I ran the find command on the entire system seraching for *jdk* and it tells me it didn't find anything. Then I go to /usr/java/ and search there and it finds the whole 1.6 jdk. How the hell did my system wide search for *jdk* not find the 1.6 jdk (and it should have found the 1.4.2 wherever it is). |
Quote:
|
Assuming your users have the default shell of bash, then put stuff like alterations to $PATH in to /etc/bash.bashrc.local - it doesn't exist by default but if you look at /etc/bash.bashrc it tells you not to put stuff in there and use /etc/bash.bashrc.local
|
Yes they're using bash. I don't see a
bash.bashrc.local just bash.bashrc Ideally I'd like to find the file that currently says "java 1.4* this way" and edit it. I want to make back up of that file and restore it if anything goes wrong. This bash.bashrc doesn't have anything like that in it. That I can find (using /java /jdk and /$PATH in vi). |
Quote:
|
Ah yes, missed that part.
If this works, that still leaves me wondering where in blue hell java1.4.2 is installed and where the original settings for that are! So I just put.. PATH=$PATH:/usr/java/jdk1.6.0_07/bin/ ..in the file and call it a day? |
Quote:
|
If you want people to get the java that belongs to 1.6 it needs to be in $PATH before 1.4.2. So you want
Code:
PATH=/usr/java/jdk1.6.0_07/bin/:$PATH Code:
linux-poir:~ # more /etc/issue Code:
|
I just echoed my path, and the correct version of java is in it, but it's still going to 1.4.2 first.
Well, at least I know where java 1.4.2 is now :) /usr/lib/jvm/jre-1.4.2-sun/bin/java Oh **** no wonder. It has jre 1.4.2. I'm installing the jdk 1.6.0_07 not the jre. So do I have to edit all these links in the /etc/alternatives/ folder? |
I tried YaST, but it's a dependency nightmare in there.
I might try just copying all of those links to different location ... or maybe tarball and delete them. Err, how do you move a link? I tried to copy it but it copied the link targets instead. EDIT: I just noticed that *everything* in this alternatives folder is java related (related to 1.4.2). I'm going to try renaming this folder. |
Well, that did it :)
Pretty dirty hack really, but it's easy to fix if it broke anything. |
You may be interested in this document from the OpenSuSE wiki. Look at the last section called "Switching between two different Java JREs or SDKs".
Regarding the PATH issue, the java executable is not in the system PATH, or better - as already pointed out by arizonagroovejet - it uses the /etc/alternatives system. However if you do Code:
$ which java Code:
$ ls -l /usr/bin/java In a more general context, the system wide PATH environment variable in most system (OpenSuSE included) is set in /etc/profile plus the scripts in /etc/profile.d directory. If you look at the code in /etc/profile you will see the statements used to set the PATH plus the following piece of code: Code:
# Hope it is a little more clear, now! :) |
OK, that's a lot more clear.
In suse there is a csh and an sh entry for each script in /etc/profile.d/ My students will use bash, so I guess that's the .sh entry? |
Quote:
|
I just set all the paths in that alljava.sh file manually (took at all the scripting and hard coded it) and moved the alternatives back were they were, and it's running 1.4.2_16 again. Should left well enough alone :)
In other words it's broken. |
Here's what I put in alljava.sh
I'm going to move it into the bash.bashrc.local for now (minus the exports) export JAVA_BINDIR=/usr/java/default/bin export JAVA_ROOT=/usr/java/default/ export JAVA_HOME=/usr/java/default/ export JRE_HOME=/usr/java/default/jre export JDK_HOME=/usr/java/default/ export SDK_HOME=/usr/java/default/ |
All times are GMT -5. The time now is 12:37 AM. |