• Post Reply Bookmark Topic Watch Topic
  • New Topic

%JAVA_HOME% version and java -version is different  RSS feed

 
Prakash Pantula
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I installed several JDK and JRE in my system like 1.5, 6 and 7 and I have added JAVA_HOME pointing to my JDK 6 installation. However, when I run java -version, it gives

java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)

How do I know, which installation of java is being used here ?

I have windows 8 as my operating system.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The command java -version does not care about your JAVA_HOME but your java path system variableiable

To see your current path variables
Open a terminal window and type
echo %path%
Hit return
 
Prakash Pantula
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Maneesh
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16057
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:The command java -version does not care about your JAVA_HOME

In fact, Java itself does not care about the JAVA_HOME environment variable at all. It's only used by some other software (for example, Apache Tomcat). If you don't use that software, setting JAVA_HOME isn't useful for anything at all.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!