Implement Java_ “Real” definition of home

As a java developer switching between Nix systems (OS X, Ubuntu,...), although I can "get" my JDK and run it at any time, it seems that Java_ Home requires Java in many applications_ There is no clear definition in the software package of home to be set:

for example

>Maven: "java_home refers to your JDK directory" > Hadoop: "java_home, which specifies the path of Java 1.5. X installation" > Sun: "java_home is the directory containing JRE"

Therefore, I have two questions (any opinion is also welcome. Specifically, I have these two questions):

1) Does the Java installation of Mac OS X copy the target from the "JavaVM. Frameworks" directory to usr / bin?

2)JAVA_ What is the "definition" of home? Obviously, we can't use Java_ Home is defined as "the place where Java is installed", because this definition is ambiguous, because Java can exist in the home location (i.e. / system / library / frameworks /...) Or directly in the / usr / bin directory?

My thoughts

I believe in Java_ Home actually means more than just a binary "Java" program JAVA_ Home may refer to the location of a set of Java related directories and binaries... However, I don't know what this is, and my definition is not accurate enough to be useful

Solution

JAVA_ Home has no definition of "real" This variable is not used by the Java runtime environment and is not standardized as part of the Java platform

It is just a convention used by applications running on the Java platform Since there is no standard, every application can freely formulate the rules of the directory that this variable should refer to; You should read the application's documentation to understand what you need

That is, if it is set to the top-level directory of the JDK installation (not the JRE in the JDK, but the JDK itself), I find that every application using this variable can work This directory should contain "bin" and "lib" subdirectories containing Java executable files and runtime libraries respectively

If you point it to JRE, some applications will work, but if you need a development tool like javac, it will fail

Usually, when I run an unneeded tool, I specify Java on the command line_ Home, because I use multiple versions of Java, as shown below:

JAVA_HOME=/usr/local/jdk1.6.0_29 ant
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>