Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Newbie on debian and trying to make Java 7 the default java version used

Tags:

linux

debian

2 questions.

  1. After installing the Oracle Java 7 on my new Debian local box, I opened up a terminal and executed the following command:

java -version

When I did that it states: java version "1.6.0_26" Java(TM) SE Runtime Environment (build 1.6.0_26-b03) Java HotSpot(TM) Client VM (build 20.1-b02, mixed mode, sharing)

I installed the Java 7 JDK and Java 7 JRE in the following directories respectively:

/usr/lib/jvm/jdk1.7.0 /usr/lib/jvm/jre1.7.0

  1. Is there a way to remove the java-6-sun and java-6-sun-1.6.0.26 folders as well or will it hurt just to leave them there?

Any help/direction on these 2 questions would be appreciated.

Regards.

like image 362
Melinda Avatar asked May 01 '12 17:05

Melinda


People also ask

How do I change the default Java version in Linux?

Suppose you install Java 11 and you had another version of Java installed earlier, you can select default Java version to use using the update-alternatives --config java command.

How do I change my Java version?

In the Java Control Panel, click on the Java tab. Verify that the latest Java Runtime version is enabled by checking the Enabled box. Click OK in Java Control Panel window to confirm changes and close the window. Try to run same applet and verify it is now running using latest version of Java installed in your system.

Does Debian have Java?

Debian provides several Java implementations. Each of them have a development environment (JDK) and a runtime (known as JRE, or Java Virtual Machines JVM). Here's a list of Java environment.


2 Answers

sudo update-alternatives --config java

Is the command to swap it i believe.

You can then call

which java

and it should reference the version selected.

like image 127
Mike McMahon Avatar answered Sep 19 '22 18:09

Mike McMahon


sudo update-java-alternatives -s ... will configure all the alternatives at the same time update-java-alternatives -l lists the alternatives

like image 36
Bastien Durel Avatar answered Sep 20 '22 18:09

Bastien Durel