LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Add to PATH (bash) for All Users (Suse) (https://www.linuxquestions.org/questions/linux-newbie-8/add-to-path-bash-for-all-users-suse-663217/)

davidstvz 08-16-2008 10:00 AM

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.

davidstvz 08-16-2008 10:09 AM

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?

bhaslinux 08-16-2008 10:11 AM

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.

davidstvz 08-16-2008 10:14 AM

Quote:

Originally Posted by bhaslinux (Post 3249692)
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.

ACK

I just tried to dump that in a file using

bash -x > zpath.txt

and now everythign is acting crazy

davidstvz 08-16-2008 10:15 AM

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.

davidstvz 08-16-2008 10:17 AM

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?

davidstvz 08-16-2008 10:53 AM

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).

pronoy 08-16-2008 02:03 PM

Quote:

Originally Posted by davidstvz (Post 3249697)
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.

bash -x has forked the second shell within the original one. You could have come out using 'exit' command

arizonagroovejet 08-16-2008 02:21 PM

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

davidstvz 08-16-2008 02:33 PM

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).

arizonagroovejet 08-16-2008 02:36 PM

Quote:

Originally Posted by davidstvz (Post 3249918)
Yes they're using bash. I don't see a

bash.bashrc.local

I refer you to the part of my post where I said that it does not exist by default.

davidstvz 08-16-2008 02:43 PM

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?

davidstvz 08-16-2008 02:44 PM

Quote:

Originally Posted by davidstvz (Post 3249930)
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?

Ok, that's not working just yet.

arizonagroovejet 08-16-2008 02:52 PM

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
Except that's not the best way to do it. A better way would be to change stuff in /etc/alternatives/ to point at your desired version of java
Code:

linux-poir:~ # more /etc/issue

Welcome to SUSE Linux Enterprise Desktop 10 SP2 (i586) - Kernel \r (\l).

linux-poir:~ # ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 2008-07-21 18:15 /usr/bin/java -> /etc/alternatives/java
linux-poir:~ # ls -l /etc/alternatives/java*
lrwxrwxrwx 1 root root 35 2008-07-21 18:23 /etc/alternatives/java -> /usr/lib/jvm/jre-1.4.2-sun/bin/java
lrwxrwxrwx 1 root root 44 2008-07-21 18:23 /etc/alternatives/java.1.gz -> /usr/share/man/man1/java-java-1_4_2-sun.1.gz
lrwxrwxrwx 1 root root 40 2008-07-21 18:23 /etc/alternatives/javaws -> /usr/lib/jvm/jre-1.4.2-sun/javaws/javaws
lrwxrwxrwx 1 root root 46 2008-07-21 18:23 /etc/alternatives/javaws.1.gz -> /usr/share/man/man1/javaws-java-1_4_2-sun.1.gz

Or you could try simply removing the Java 1.4.2 rpm

Code:


linux-poir:~ # rpm -qf /usr/lib/jvm/jre-1.4.2-sun/bin/java
java-1_4_2-sun-1.4.2.17-0.2

but I haven't tried that - it may well have a bunch of stuff that claims it as a dependency.

davidstvz 08-16-2008 02:58 PM

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?


All times are GMT -5. The time now is 03:37 PM.