Mary
Mary

Reputation: 221

How to find the location of an older installed java on linux?

Please be patient with me if you find the question is basic for you as a professional.

For running a program, java version of 1.7 is required. however the current java version on our cluster is 1.8 (see below). I think the java of 1.7 has been installed, but I don't know its location. Could you please let me know how to find the location of java 1.7? I want to add it to PATH for running my program

java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)

Thanks

Upvotes: 1

Views: 180

Answers (1)

Idos
Idos

Reputation: 15320

You can use (on most Linux distributions):

sudo update-alternatives --config java

To view all the packages. Then use Ctrl+C to quit the update...

Edit: Just found this on Superuser.

Edit: Use this command: for f in $(locate -ber '^java$'); do test -x && echo "$f"; done

And then copy the appropriate result to your PATH i.e:

/usr/java/jdk1.7.0_51/bin

Upvotes: 1

Related Questions