• Post Reply Bookmark Topic Watch Topic
  • New Topic

Linux - get JDK version  RSS feed

 
Alessandro Ilardo
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
suppose that I can only access to a customer server running Linux via terminal and I need to know which JDK is currently installed (but I don't know where). How can I do that?

Thanks in advance
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Alessandro Ilardo:
Hi there,
suppose that I can only access to a customer server running Linux via terminal and I need to know which JDK is currently installed (but I don't know where). How can I do that?

Thanks in advance


Well, if there is a version of Java in the path, you can always run "which java", to find out which one will be running when executed from the command prompt. If the version of Java is not in your path, then you can run "whereis java", which will check a few common locations.

Otherwise, it is difficult to tell, as the system may have multiple JRE and JDK installed, for different users or scripts (which change the path).

Henry
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let the user type in java -version in a shell window. That will tell you which version of Java is in the path of that user first.
[ February 05, 2007: Message edited by: Jesper Young ]
 
Alessandro Ilardo
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that says which jre is in the classpath. I need to know the jdk version
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can also try javac -version which will tell you the version of the Java compiler - but note that the "-version" switch was only added in version 5 or 6 of the JDK (don't remember exactly which of the two). So if you get an error message, then at least you know it is an older JDK version.

Also note Henry's answer.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!