LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-22-2011, 10:22 AM   #1
davholla
Member
 
Registered: Jun 2003
Location: London
Distribution: Linux Mint 13 Maya
Posts: 729

Rep: Reputation: 32
Java version not the one I have installed


I have installed Java 1.6.0
Code:
/usr/local/jdk1.6.0_24/
But I still get the old version
Code:
java -version
java version "1.4.2"
gij (GNU libgcj) version 4.1.2 20080704 (Red Hat 4.1.2-50)

Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE

I know that I need to change my bash_profile but when I try it does not solve the problem


Code:
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin
PATH=$PATH:/usr/local/jdk1.6.0_24/bin/
export PATH
What am I doing wrong?
 
Old 03-22-2011, 10:35 AM   #2
SL00b
Member
 
Registered: Feb 2011
Location: LA, US
Distribution: SLES
Posts: 375

Rep: Reputation: 112Reputation: 112
You added your new java path to the end of your path statement, but the previous JDK was already in your path, and is therefore coming up first in your search order.

First, verify your change to .bash_profile has successfully updated your path (I usually make these changes to .bashrc):

Code:
echo $PATH
If so, then go back and reverse the order of your path arguments in .bash_profile so that the new JDK comes up first. I don't see any reason for having multiple path statements, so...

Code:
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

export PATH=/usr/local/jdk1.6.0_24/bin:$PATH:$HOME/bin

Last edited by SL00b; 03-22-2011 at 10:36 AM.
 
1 members found this post helpful.
Old 03-22-2011, 11:49 AM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
A previous java will usually be a link /usr/bin/java to /etc/alternatives/java.

I don't think, the bashrc will override that.

Default install location : /usr/java/jdk1.6.0_24

And the default way of setting up java : 1) su
2)
/usr/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_24/bin/java 2

3) /usr/sbin/alternatives --config java
.... Then select version : sun.
....
 
Old 03-22-2011, 11:53 AM   #4
davholla
Member
 
Registered: Jun 2003
Location: London
Distribution: Linux Mint 13 Maya
Posts: 729

Original Poster
Rep: Reputation: 32
That fixed it - I mean changing the profile fixed
Code:
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

export PATH=/usr/local/jdk1.6.0_24/bin:$PATH:$HOME/bin

Last edited by davholla; 03-22-2011 at 11:57 AM. Reason: To improve clarity
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Java plugin installed correctly for Firefox but not able to view any java applet tvn Linux - Software 10 04-15-2010 02:13 AM
Iceweasel Java plugin using the Apt version of Sun Java? Zaskar Debian 3 10-03-2008 07:35 AM
java -version, bash: java: command not found kirman Programming 4 03-19-2008 11:13 PM
Installed GCC version doesn't match the version the kernel was compiled with AlucardZero Linux - Software 2 02-07-2008 10:24 AM
FC3 installed Limewire crashes with wrong Java version arst05 Fedora 10 03-21-2005 12:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:54 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
Open Source Consulting | Domain Registration