maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marcelo Souza (JIRA)" <>
Subject [jira] [Commented] (MNG-5756) Java home output in mvn -v is misleading
Date Fri, 12 May 2017 20:31:04 GMT


Marcelo Souza commented on MNG-5756:

Hi. I committed but my e-mail have not correct. My email out but
the correct is

I change in my git for correct email.

> Java home output in mvn -v is misleading
> ----------------------------------------
>                 Key: MNG-5756
>                 URL:
>             Project: Maven
>          Issue Type: Improvement
>          Components: Command Line
>    Affects Versions: 3.2.5, 3.3.3
>         Environment: any
>            Reporter: Jarkko Rantavuori
>            Priority: Minor
> For example on my windows box, mvn -v prints the following:
> {code}
> Java home: C:\Program Files (x86)\Java\jdk1.7.0_51\jre
> {code}
> But my JAVA_HOME is actually
> {code}
> > echo %JAVA_HOME%
> C:\Program Files (x86)\Java\jdk1.7.0_51
> {code}
> In the source code, the line comes from:
> {code}
> version.append( "Java home: " ).append( System.getProperty( "java.home", "<unknown
java home>" ) ).append( ls );
> {code}
> which is using property "java.home" to fetch java home. However, "java.home" property
is not JAVA_HOME! This is explained in detail in here:
> To quote:
> {quote}
>     What's the difference between JAVA_HOME and java.home?
>     JAVA_HOME is the JDK install directory, e.g., C:\jdk5. It's meant to be set as an
environment variable and referenced in Windows batch files or Unix scripts. I always have
it in my Windows Control Panel and .tcsh files,along with other common environment variables.
Some Java applications use the name jdk.home for this purpose, which I think is a better name.
But JAVA_HOME has been used since the beginning and is now a convention.
>     java.home is the JRE install directory, e.g., C:\jdk5\jre, or C:\Program Files\Java\jre1.5.0_06.
Unlike JAVA_HOME, I never seen java.home as an environment variable. java.home is a build-in
Java system property, whose value is the JRE install directory. Since all Java system properties
are also exposed as Ant build properties, you can also use $&lcub;java.home&rcub;
in build files.
>     Would jre.home be a better name? Maybe, but I don't think Sun will change it.
> {quote}
> This is a source of constant confusion. Some stackoverflow threads to illustrate:
> The correct way to print JAVA_HOME would be to use System.getenv("JAVA_HOME"). Either
that should be used or current output should be changed so it wouldn't be so misleading.

This message was sent by Atlassian JIRA

View raw message