Check java version without java -version
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
6
down vote
favorite
I get the following error while trying to compile or run everything that has to do with java
or javac
:
Error occurred during initialization of VM
java/lang/ClassNotFoundException: error in opening JAR file <Zip file open error> /usr/lib/jvm/java-8-oracle/jre/lib/rt.jar
I've read here that i should uninstall and install again JDK, here it is written that I should know which version of java I have installed on my pc in order to uninstall-it.
To check the version installed i run java -version
but i get the error mentioned above, how can i check my java version without that command?
I know that i have installed java 8 but i don't know precisely which version it is.
java jdk
add a comment |Â
up vote
6
down vote
favorite
I get the following error while trying to compile or run everything that has to do with java
or javac
:
Error occurred during initialization of VM
java/lang/ClassNotFoundException: error in opening JAR file <Zip file open error> /usr/lib/jvm/java-8-oracle/jre/lib/rt.jar
I've read here that i should uninstall and install again JDK, here it is written that I should know which version of java I have installed on my pc in order to uninstall-it.
To check the version installed i run java -version
but i get the error mentioned above, how can i check my java version without that command?
I know that i have installed java 8 but i don't know precisely which version it is.
java jdk
"I know that i have installed java 8 but i don't know precisely which version it is." Installed how?
â muru
Apr 13 at 12:14
add a comment |Â
up vote
6
down vote
favorite
up vote
6
down vote
favorite
I get the following error while trying to compile or run everything that has to do with java
or javac
:
Error occurred during initialization of VM
java/lang/ClassNotFoundException: error in opening JAR file <Zip file open error> /usr/lib/jvm/java-8-oracle/jre/lib/rt.jar
I've read here that i should uninstall and install again JDK, here it is written that I should know which version of java I have installed on my pc in order to uninstall-it.
To check the version installed i run java -version
but i get the error mentioned above, how can i check my java version without that command?
I know that i have installed java 8 but i don't know precisely which version it is.
java jdk
I get the following error while trying to compile or run everything that has to do with java
or javac
:
Error occurred during initialization of VM
java/lang/ClassNotFoundException: error in opening JAR file <Zip file open error> /usr/lib/jvm/java-8-oracle/jre/lib/rt.jar
I've read here that i should uninstall and install again JDK, here it is written that I should know which version of java I have installed on my pc in order to uninstall-it.
To check the version installed i run java -version
but i get the error mentioned above, how can i check my java version without that command?
I know that i have installed java 8 but i don't know precisely which version it is.
java jdk
java jdk
edited Apr 13 at 10:45
![](https://i.stack.imgur.com/E0SEH.png?s=32&g=1)
![](https://i.stack.imgur.com/E0SEH.png?s=32&g=1)
David Foerster
26.1k1361106
26.1k1361106
asked Apr 13 at 8:47
![](https://lh6.googleusercontent.com/-1CIQH1Odgd4/AAAAAAAAAAI/AAAAAAAAADs/rsewUiShkr0/photo.jpg?sz=32)
![](https://lh6.googleusercontent.com/-1CIQH1Odgd4/AAAAAAAAAAI/AAAAAAAAADs/rsewUiShkr0/photo.jpg?sz=32)
Zeno Raiser
16011
16011
"I know that i have installed java 8 but i don't know precisely which version it is." Installed how?
â muru
Apr 13 at 12:14
add a comment |Â
"I know that i have installed java 8 but i don't know precisely which version it is." Installed how?
â muru
Apr 13 at 12:14
"I know that i have installed java 8 but i don't know precisely which version it is." Installed how?
â muru
Apr 13 at 12:14
"I know that i have installed java 8 but i don't know precisely which version it is." Installed how?
â muru
Apr 13 at 12:14
add a comment |Â
4 Answers
4
active
oldest
votes
up vote
2
down vote
accepted
You can use this command for checking your java version:
update-alternatives --config java
7
Wouldn'tupdate-alternatives --display java
be simpler and better since OP only wants to âÂÂdisplayâ available Java versions, not change the default? That wouldn't even requiresudo
.
â David Foerster
Apr 13 at 10:47
add a comment |Â
up vote
6
down vote
To show what version of Java is installed without running java -version
, open the terminal and type:
apt policy openjdk-* oracle-java*
A small part of the results of apt policy openjdk-*
looks like this:
openjdk-7-jre-lib:
Installed: (none)
Candidate: (none)
Version table:
openjdk-8-jdk:
Installed: 8u162-b12-0ubuntu0.16.04.2
Candidate: 8u162-b12-0ubuntu0.16.04.2
Search for sections that contain either openjdk-*-jre
, openjdk-*-jdk
or oracle-java*
where the wildcard *
character can be a Java version number like 6, 7, 8 or 9.
thanks, with that command i got tons of lines which one should i search for?
â Zeno Raiser
Apr 13 at 8:57
add a comment |Â
up vote
4
down vote
You can discover the full path of the default java
executable with:
readlink -f "$(which java)"
All (sane) Java packages or bundles that I know use installation path names that include the vendor name and major version number which would answer your question. E. g. on my system
$ readlink -f "$(which java)"
/usr/lib/jvm/java-9-openjdk-amd64/bin/java
tells me that the default Java installation is OpenJDK 9.
add a comment |Â
up vote
2
down vote
You could also try:
dpkg -l | egrep -i 'jre|java|jdk'
add a comment |Â
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
You can use this command for checking your java version:
update-alternatives --config java
7
Wouldn'tupdate-alternatives --display java
be simpler and better since OP only wants to âÂÂdisplayâ available Java versions, not change the default? That wouldn't even requiresudo
.
â David Foerster
Apr 13 at 10:47
add a comment |Â
up vote
2
down vote
accepted
You can use this command for checking your java version:
update-alternatives --config java
7
Wouldn'tupdate-alternatives --display java
be simpler and better since OP only wants to âÂÂdisplayâ available Java versions, not change the default? That wouldn't even requiresudo
.
â David Foerster
Apr 13 at 10:47
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
You can use this command for checking your java version:
update-alternatives --config java
You can use this command for checking your java version:
update-alternatives --config java
edited Apr 18 at 6:49
Campa
366411
366411
answered Apr 13 at 9:00
![](https://i.stack.imgur.com/2jRBV.jpg?s=32&g=1)
![](https://i.stack.imgur.com/2jRBV.jpg?s=32&g=1)
Eranda Peiris
661416
661416
7
Wouldn'tupdate-alternatives --display java
be simpler and better since OP only wants to âÂÂdisplayâ available Java versions, not change the default? That wouldn't even requiresudo
.
â David Foerster
Apr 13 at 10:47
add a comment |Â
7
Wouldn'tupdate-alternatives --display java
be simpler and better since OP only wants to âÂÂdisplayâ available Java versions, not change the default? That wouldn't even requiresudo
.
â David Foerster
Apr 13 at 10:47
7
7
Wouldn't
update-alternatives --display java
be simpler and better since OP only wants to âÂÂdisplayâ available Java versions, not change the default? That wouldn't even require sudo
.â David Foerster
Apr 13 at 10:47
Wouldn't
update-alternatives --display java
be simpler and better since OP only wants to âÂÂdisplayâ available Java versions, not change the default? That wouldn't even require sudo
.â David Foerster
Apr 13 at 10:47
add a comment |Â
up vote
6
down vote
To show what version of Java is installed without running java -version
, open the terminal and type:
apt policy openjdk-* oracle-java*
A small part of the results of apt policy openjdk-*
looks like this:
openjdk-7-jre-lib:
Installed: (none)
Candidate: (none)
Version table:
openjdk-8-jdk:
Installed: 8u162-b12-0ubuntu0.16.04.2
Candidate: 8u162-b12-0ubuntu0.16.04.2
Search for sections that contain either openjdk-*-jre
, openjdk-*-jdk
or oracle-java*
where the wildcard *
character can be a Java version number like 6, 7, 8 or 9.
thanks, with that command i got tons of lines which one should i search for?
â Zeno Raiser
Apr 13 at 8:57
add a comment |Â
up vote
6
down vote
To show what version of Java is installed without running java -version
, open the terminal and type:
apt policy openjdk-* oracle-java*
A small part of the results of apt policy openjdk-*
looks like this:
openjdk-7-jre-lib:
Installed: (none)
Candidate: (none)
Version table:
openjdk-8-jdk:
Installed: 8u162-b12-0ubuntu0.16.04.2
Candidate: 8u162-b12-0ubuntu0.16.04.2
Search for sections that contain either openjdk-*-jre
, openjdk-*-jdk
or oracle-java*
where the wildcard *
character can be a Java version number like 6, 7, 8 or 9.
thanks, with that command i got tons of lines which one should i search for?
â Zeno Raiser
Apr 13 at 8:57
add a comment |Â
up vote
6
down vote
up vote
6
down vote
To show what version of Java is installed without running java -version
, open the terminal and type:
apt policy openjdk-* oracle-java*
A small part of the results of apt policy openjdk-*
looks like this:
openjdk-7-jre-lib:
Installed: (none)
Candidate: (none)
Version table:
openjdk-8-jdk:
Installed: 8u162-b12-0ubuntu0.16.04.2
Candidate: 8u162-b12-0ubuntu0.16.04.2
Search for sections that contain either openjdk-*-jre
, openjdk-*-jdk
or oracle-java*
where the wildcard *
character can be a Java version number like 6, 7, 8 or 9.
To show what version of Java is installed without running java -version
, open the terminal and type:
apt policy openjdk-* oracle-java*
A small part of the results of apt policy openjdk-*
looks like this:
openjdk-7-jre-lib:
Installed: (none)
Candidate: (none)
Version table:
openjdk-8-jdk:
Installed: 8u162-b12-0ubuntu0.16.04.2
Candidate: 8u162-b12-0ubuntu0.16.04.2
Search for sections that contain either openjdk-*-jre
, openjdk-*-jdk
or oracle-java*
where the wildcard *
character can be a Java version number like 6, 7, 8 or 9.
edited Apr 13 at 10:52
answered Apr 13 at 8:53
![](https://i.stack.imgur.com/zqElV.png?s=32&g=1)
![](https://i.stack.imgur.com/zqElV.png?s=32&g=1)
karel
50.5k11107127
50.5k11107127
thanks, with that command i got tons of lines which one should i search for?
â Zeno Raiser
Apr 13 at 8:57
add a comment |Â
thanks, with that command i got tons of lines which one should i search for?
â Zeno Raiser
Apr 13 at 8:57
thanks, with that command i got tons of lines which one should i search for?
â Zeno Raiser
Apr 13 at 8:57
thanks, with that command i got tons of lines which one should i search for?
â Zeno Raiser
Apr 13 at 8:57
add a comment |Â
up vote
4
down vote
You can discover the full path of the default java
executable with:
readlink -f "$(which java)"
All (sane) Java packages or bundles that I know use installation path names that include the vendor name and major version number which would answer your question. E. g. on my system
$ readlink -f "$(which java)"
/usr/lib/jvm/java-9-openjdk-amd64/bin/java
tells me that the default Java installation is OpenJDK 9.
add a comment |Â
up vote
4
down vote
You can discover the full path of the default java
executable with:
readlink -f "$(which java)"
All (sane) Java packages or bundles that I know use installation path names that include the vendor name and major version number which would answer your question. E. g. on my system
$ readlink -f "$(which java)"
/usr/lib/jvm/java-9-openjdk-amd64/bin/java
tells me that the default Java installation is OpenJDK 9.
add a comment |Â
up vote
4
down vote
up vote
4
down vote
You can discover the full path of the default java
executable with:
readlink -f "$(which java)"
All (sane) Java packages or bundles that I know use installation path names that include the vendor name and major version number which would answer your question. E. g. on my system
$ readlink -f "$(which java)"
/usr/lib/jvm/java-9-openjdk-amd64/bin/java
tells me that the default Java installation is OpenJDK 9.
You can discover the full path of the default java
executable with:
readlink -f "$(which java)"
All (sane) Java packages or bundles that I know use installation path names that include the vendor name and major version number which would answer your question. E. g. on my system
$ readlink -f "$(which java)"
/usr/lib/jvm/java-9-openjdk-amd64/bin/java
tells me that the default Java installation is OpenJDK 9.
answered Apr 13 at 10:54
![](https://i.stack.imgur.com/E0SEH.png?s=32&g=1)
![](https://i.stack.imgur.com/E0SEH.png?s=32&g=1)
David Foerster
26.1k1361106
26.1k1361106
add a comment |Â
add a comment |Â
up vote
2
down vote
You could also try:
dpkg -l | egrep -i 'jre|java|jdk'
add a comment |Â
up vote
2
down vote
You could also try:
dpkg -l | egrep -i 'jre|java|jdk'
add a comment |Â
up vote
2
down vote
up vote
2
down vote
You could also try:
dpkg -l | egrep -i 'jre|java|jdk'
You could also try:
dpkg -l | egrep -i 'jre|java|jdk'
edited Apr 13 at 10:50
![](https://i.stack.imgur.com/E0SEH.png?s=32&g=1)
![](https://i.stack.imgur.com/E0SEH.png?s=32&g=1)
David Foerster
26.1k1361106
26.1k1361106
answered Apr 13 at 10:17
![](https://i.stack.imgur.com/MATL0.jpg?s=32&g=1)
![](https://i.stack.imgur.com/MATL0.jpg?s=32&g=1)
muclux
2,1231522
2,1231522
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%2f1024582%2fcheck-java-version-without-java-version%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
"I know that i have installed java 8 but i don't know precisely which version it is." Installed how?
â muru
Apr 13 at 12:14