LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-16-2008, 11:00 AM   #1
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Rep: Reputation: 30
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.

Last edited by davidstvz; 08-16-2008 at 11:07 AM.
 
Old 08-16-2008, 11:09 AM   #2
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Original Poster
Rep: Reputation: 30
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?

Last edited by davidstvz; 08-16-2008 at 11:12 AM.
 
Old 08-16-2008, 11:11 AM   #3
bhaslinux
Member
 
Registered: Oct 2003
Location: UnitedKingdom
Distribution: Debian Lenny
Posts: 351

Rep: Reputation: 47
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.
 
Old 08-16-2008, 11:14 AM   #4
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by bhaslinux View Post
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
 
Old 08-16-2008, 11:15 AM   #5
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Original Poster
Rep: Reputation: 30
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.

Last edited by davidstvz; 08-16-2008 at 11:16 AM.
 
Old 08-16-2008, 11:17 AM   #6
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Original Poster
Rep: Reputation: 30
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?

Last edited by davidstvz; 08-16-2008 at 11:26 AM.
 
Old 08-16-2008, 11:53 AM   #7
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Original Poster
Rep: Reputation: 30
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).

Last edited by davidstvz; 08-16-2008 at 11:54 AM.
 
Old 08-16-2008, 03:03 PM   #8
pronoy
Member
 
Registered: Mar 2005
Location: india
Distribution: FC4, Debian Etch
Posts: 67

Rep: Reputation: Disabled
Quote:
Originally Posted by davidstvz View Post
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
 
Old 08-16-2008, 03:21 PM   #9
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,078

Rep: Reputation: 195Reputation: 195
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
 
Old 08-16-2008, 03:33 PM   #10
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Original Poster
Rep: Reputation: 30
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).
 
Old 08-16-2008, 03:36 PM   #11
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,078

Rep: Reputation: 195Reputation: 195
Quote:
Originally Posted by davidstvz View Post
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.
 
Old 08-16-2008, 03:43 PM   #12
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Original Poster
Rep: Reputation: 30
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?
 
Old 08-16-2008, 03:44 PM   #13
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by davidstvz View Post
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.
 
Old 08-16-2008, 03:52 PM   #14
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,078

Rep: Reputation: 195Reputation: 195
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.
 
Old 08-16-2008, 03:58 PM   #15
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Original Poster
Rep: Reputation: 30
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?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Add to path of all users home Dir. abovenbeyond Linux - Server 1 12-18-2007 06:27 PM
How to add paths to sbin, bin/bash, bin sh for users gopi.d Fedora 3 12-07-2007 01:47 AM
how to: add to $PATH?? (SUSE) epsilon72 Linux - Software 10 03-15-2007 11:10 PM
How add a $PATH at boot for all users JBull Linux - General 5 12-11-2006 01:35 PM
add path and variables bash malcolmBl Linux - Newbie 3 05-18-2006 06:11 AM


All times are GMT -5. The time now is 09:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration