Struggling with Duplicate Java JRE version on Ubuntu

Clash Royale CLAN TAG#URR8PPP up vote
0
down vote
favorite
I have installed java jdk 9 and java jre 9 on ubuntu and set the path of both to /etc/environment as /usr/local/jdk-9.0.4:/usr/local/jre-9.0.4/bin then I tested javac -version which prints jdk9 but when I run java -version it prints
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.17.10.2-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
I don't know where the openjdk is installed. I think it is installed with the MAVEN.
Here is the /etc/environment content
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/jdk-9.0.4/bin"
JAVA_HOME="/usr/local/jdk-9.0.4:/usr/local/jre-9.0.4/bin"
software-installation java jdk openjdk
add a comment |Â
up vote
0
down vote
favorite
I have installed java jdk 9 and java jre 9 on ubuntu and set the path of both to /etc/environment as /usr/local/jdk-9.0.4:/usr/local/jre-9.0.4/bin then I tested javac -version which prints jdk9 but when I run java -version it prints
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.17.10.2-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
I don't know where the openjdk is installed. I think it is installed with the MAVEN.
Here is the /etc/environment content
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/jdk-9.0.4/bin"
JAVA_HOME="/usr/local/jdk-9.0.4:/usr/local/jre-9.0.4/bin"
software-installation java jdk openjdk
How did you install jdk/jre9? Via apt? What is the output ofupdate-java-alternatives --list(may need sudo, but not sure)?
â danzel
Mar 21 at 11:05
openJDK install automatically when I installed maven. but the other version java 9 is installed in /usr/local by self. extracting the zip file there.
â Asif Mushtaq
Mar 21 at 11:43
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have installed java jdk 9 and java jre 9 on ubuntu and set the path of both to /etc/environment as /usr/local/jdk-9.0.4:/usr/local/jre-9.0.4/bin then I tested javac -version which prints jdk9 but when I run java -version it prints
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.17.10.2-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
I don't know where the openjdk is installed. I think it is installed with the MAVEN.
Here is the /etc/environment content
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/jdk-9.0.4/bin"
JAVA_HOME="/usr/local/jdk-9.0.4:/usr/local/jre-9.0.4/bin"
software-installation java jdk openjdk
I have installed java jdk 9 and java jre 9 on ubuntu and set the path of both to /etc/environment as /usr/local/jdk-9.0.4:/usr/local/jre-9.0.4/bin then I tested javac -version which prints jdk9 but when I run java -version it prints
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.17.10.2-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
I don't know where the openjdk is installed. I think it is installed with the MAVEN.
Here is the /etc/environment content
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/jdk-9.0.4/bin"
JAVA_HOME="/usr/local/jdk-9.0.4:/usr/local/jre-9.0.4/bin"
software-installation java jdk openjdk
software-installation java jdk openjdk
asked Mar 21 at 7:58
Asif Mushtaq
1011
1011
How did you install jdk/jre9? Via apt? What is the output ofupdate-java-alternatives --list(may need sudo, but not sure)?
â danzel
Mar 21 at 11:05
openJDK install automatically when I installed maven. but the other version java 9 is installed in /usr/local by self. extracting the zip file there.
â Asif Mushtaq
Mar 21 at 11:43
add a comment |Â
How did you install jdk/jre9? Via apt? What is the output ofupdate-java-alternatives --list(may need sudo, but not sure)?
â danzel
Mar 21 at 11:05
openJDK install automatically when I installed maven. but the other version java 9 is installed in /usr/local by self. extracting the zip file there.
â Asif Mushtaq
Mar 21 at 11:43
How did you install jdk/jre9? Via apt? What is the output of
update-java-alternatives --list (may need sudo, but not sure)?â danzel
Mar 21 at 11:05
How did you install jdk/jre9? Via apt? What is the output of
update-java-alternatives --list (may need sudo, but not sure)?â danzel
Mar 21 at 11:05
openJDK install automatically when I installed maven. but the other version java 9 is installed in /usr/local by self. extracting the zip file there.
â Asif Mushtaq
Mar 21 at 11:43
openJDK install automatically when I installed maven. but the other version java 9 is installed in /usr/local by self. extracting the zip file there.
â Asif Mushtaq
Mar 21 at 11:43
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
When you installed maven, openjdk-8-jre-headless was installed as a dependency. The Java Runtime Environment (jre) does include the java binary, but not the Java compiler (javac). The java binary (or, to be more specific, a link to it) now resides in /usr/bin. Since the PATH-variable is processed left-to-right, executing java executes /usr/bin/java, whereas javac executes /usr/local/jdk-9.0.4/bin/javac because it was not found in any other folder contained in PATH. You can check this yourself using the which command, e.g. which java or which javac.
The openjdk8 jre is most likely installed in /usr/lib/jvm/java-8... and its binaries are linked in /usr/bin by the Debian Alternatives System.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
When you installed maven, openjdk-8-jre-headless was installed as a dependency. The Java Runtime Environment (jre) does include the java binary, but not the Java compiler (javac). The java binary (or, to be more specific, a link to it) now resides in /usr/bin. Since the PATH-variable is processed left-to-right, executing java executes /usr/bin/java, whereas javac executes /usr/local/jdk-9.0.4/bin/javac because it was not found in any other folder contained in PATH. You can check this yourself using the which command, e.g. which java or which javac.
The openjdk8 jre is most likely installed in /usr/lib/jvm/java-8... and its binaries are linked in /usr/bin by the Debian Alternatives System.
add a comment |Â
up vote
1
down vote
When you installed maven, openjdk-8-jre-headless was installed as a dependency. The Java Runtime Environment (jre) does include the java binary, but not the Java compiler (javac). The java binary (or, to be more specific, a link to it) now resides in /usr/bin. Since the PATH-variable is processed left-to-right, executing java executes /usr/bin/java, whereas javac executes /usr/local/jdk-9.0.4/bin/javac because it was not found in any other folder contained in PATH. You can check this yourself using the which command, e.g. which java or which javac.
The openjdk8 jre is most likely installed in /usr/lib/jvm/java-8... and its binaries are linked in /usr/bin by the Debian Alternatives System.
add a comment |Â
up vote
1
down vote
up vote
1
down vote
When you installed maven, openjdk-8-jre-headless was installed as a dependency. The Java Runtime Environment (jre) does include the java binary, but not the Java compiler (javac). The java binary (or, to be more specific, a link to it) now resides in /usr/bin. Since the PATH-variable is processed left-to-right, executing java executes /usr/bin/java, whereas javac executes /usr/local/jdk-9.0.4/bin/javac because it was not found in any other folder contained in PATH. You can check this yourself using the which command, e.g. which java or which javac.
The openjdk8 jre is most likely installed in /usr/lib/jvm/java-8... and its binaries are linked in /usr/bin by the Debian Alternatives System.
When you installed maven, openjdk-8-jre-headless was installed as a dependency. The Java Runtime Environment (jre) does include the java binary, but not the Java compiler (javac). The java binary (or, to be more specific, a link to it) now resides in /usr/bin. Since the PATH-variable is processed left-to-right, executing java executes /usr/bin/java, whereas javac executes /usr/local/jdk-9.0.4/bin/javac because it was not found in any other folder contained in PATH. You can check this yourself using the which command, e.g. which java or which javac.
The openjdk8 jre is most likely installed in /usr/lib/jvm/java-8... and its binaries are linked in /usr/bin by the Debian Alternatives System.
answered Mar 21 at 15:03
danzel
1,386512
1,386512
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1017860%2fstruggling-with-duplicate-java-jre-version-on-ubuntu%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
How did you install jdk/jre9? Via apt? What is the output of
update-java-alternatives --list(may need sudo, but not sure)?â danzel
Mar 21 at 11:05
openJDK install automatically when I installed maven. but the other version java 9 is installed in /usr/local by self. extracting the zip file there.
â Asif Mushtaq
Mar 21 at 11:43