LinuxQuestions.org
Visit Jeremy's Blog.
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 01-24-2005, 04:35 AM   #1
Alwyn
LQ Newbie
 
Registered: Jan 2005
Distribution: Fedora Core 3
Posts: 17

Rep: Reputation: 0
changing the java path


Hi all,

If I type the following: echo $PATH
this is the output:
usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/jdk1.5.0/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin

My problem is as follows:
I want the PATH to start looking in usr/local/jdk1.5.0/bin and the the rest should follow.
(it should echo sometihng like this -- /usr/local/jdk1.5.0/bin:/usr/kerberos/sbin bla bla bla)
I know that I should edit the /etc/profile file but I can't seem to get it right:
This is what the /etc/profile file looks like
---start
# Path manipulation
if [ `id -u` = 0 ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
fi

pathmunge /usr/X11R6/bin after


# No core files by default
ulimit -S -c 0 > /dev/null 2>&1

USER="`id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"

HOSTNAME=`/bin/hostname`
HISTSIZE=1000
JAVA_HOME=/usr/local/jdk1.5.0

if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
INPUTRC=/etc/inputrc
fi

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH

for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
. $i
fi
done

unset i
unset pathmunge
---end

I have tried puttng JAVA_HOME just after the export command and not at the end of the line but that does not help.

If you ask me why would I like to do all of this? Well I'm having issues installing a self extracting binary and the installer is 'using' a java vm not in JAVA_HOME (jdk1.5) but in java/bin (jdk1.4)

Btw I'm running Fedora Core 3.

Any help will be greatly appreciated
Thanks in advance
Alwyn
 
Old 01-24-2005, 05:16 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,903

Rep: Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611
You must first define PATH and then export PATH
 
Old 01-24-2005, 05:57 AM   #3
Alwyn
LQ Newbie
 
Registered: Jan 2005
Distribution: Fedora Core 3
Posts: 17

Original Poster
Rep: Reputation: 0
Quote:
You must first define PATH and then export PATH
OK, I made the following changes in /etc/profile

FROM

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH

TO
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC JAVA_HOME

This did not have any effect and echo $PATH still outputs:

/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/jdk1.5.0/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin

Should I not maybe alter the /etc/bashrc file?


thx
Alwyn
 
Old 01-24-2005, 06:25 AM   #4
chii-chan
Member
 
Registered: Sep 2003
Location: chikyuu (E103N6)
Distribution: Redhat 8.0 (2.4.25-custom), Fedora Core 1 (2.4.30-custom)
Posts: 357

Rep: Reputation: 30
Did you refresh the path? I mean typing:

Code:
. /etc/profile
 
Old 01-24-2005, 06:35 AM   #5
Alwyn
LQ Newbie
 
Registered: Jan 2005
Distribution: Fedora Core 3
Posts: 17

Original Poster
Rep: Reputation: 0
nice one! That did the trick - thanks!
It's just funny cause did reboot after making the changes and by default I thought the path would have been refreshed.....or maybe it's just me

Alwyn
 
  


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
Changing path trotsky Linux - Newbie 3 09-03-2005 05:09 PM
changing the path liljhand Linux - Software 5 01-30-2005 05:37 AM
$PATH keeps changing? linux_dejan Linux - Software 1 04-11-2004 04:32 PM
Java can't find package, but PATH set correctly (j2se1.4.0, java.util.regex package) Ethan Programming 5 02-06-2004 10:55 PM
changing PATH toxic53 Linux - Newbie 1 09-27-2001 01:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:04 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