0

I'm running java under a Red Hat Linux 3.4.6 and I have java version 1.4.2 installed somewhere.

I've downloaded and installed the tar.gz file for java jdk7. I've gunzipped the file and also added the installed folder to the path.

The problem is that when I write java -version in the terminal it shows

   java version "1.4.2"

I'm trying to run a code written in java, but I need the latest version installed.

Any help will be greatly appreciated.

UPDATE

I've run the instructions outlined in [oracle's tutorial][1] on how to set the path. It says:

For bash Shell: 1. Edit the startup file (~/ .bashrc) 2. Modify PATH variable:

PATH=/usr/local/jdk1.6.0/bin
  1. export PATH
  2. Save and close the file
  3. Open new Terminal window
  4. Verify the PATH is set properly

    % java -version

Now when I run

$ echo $JAVA_HOME
$ echo $PATH

eveything seems to be fine, but when I type java -version a terrible error appears:

Error dl failure on line 875
Error failed /opt/jdk1.7.0/jre/lib/i386/client/libjvm.so, because
/lib/tls/libc.so.6: version `GLIBC-2.4' not found 
(required by /opt/jdk1.7.0/jre/lib/i386/client/libjvm.so)

1 Answer 1

1

Your shell searches for the executables in the directories listed in your PATH variable. See

echo $PATH

If you are running the bash shell, then type the command

type -a java-version

and

type -a java

You will then see all directories where bash is finding these two executables. You will have either to prepend your new jdk7 installation directory (the bin directory in there!) to your PATH, or start java giving the absolute path to the version you want.

If you installed jdk7 under /usr/local/jdk7, then start the java executable in there typing

/usr/local/jdk7/bin/java

or prepend /usr/local/jdk7/bin to your PATH variable with

export PATH=/usr/local/jdk7/bin:$PATH

Hope this helps.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .