什么是JAVA_HOME? JVM如何找到存储在JAVA_HOME中的javac路径? [英] What is JAVA_HOME? How does the JVM find the javac path stored in JAVA_HOME?

查看:191
本文介绍了什么是JAVA_HOME? JVM如何找到存储在JAVA_HOME中的javac路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道什么是JAVA_HOME。我在哪里设置javac.exe和java.exe的路径。它在环境变量中。当我从命令提示符编译Java程序时,JVM如何找到 javac.exe

I would like to know what is JAVA_HOME. Where do I set the path of javac.exe and java.exe. It is in environment variables. When I compile a Java program from command prompt, how does the JVM find javac.exe?

推荐答案

JVM找不到 java.exe 。它甚至没有打电话给它。 java.exe 由操作系统调用(在本例中为Windows)。

JVM does not find java.exe. It doesn't even call it. java.exe is called by the operating system (Windows in this case).

JAVA_HOME 只是一种惯例,通常由Tomcat,其他Java EE应用服务器和构建工具(如 Gradle 查找Java所在的位置。

JAVA_HOME is just a convention, usually used by Tomcat, other Java EE app servers and build tools such as Gradle to find where Java lives.

从您的角度来看,重要的是Java / bin 目录位于您的 PATH 因此Windows可以找到JDK附带的 .exe 工具: javac.exe java.exe jar.exe 等。

The important thing from your point of view is that the Java /bin directory be on your PATH so Windows can find the .exe tools that ship with the JDK: javac.exe, java.exe, jar.exe, etc.

这篇关于什么是JAVA_HOME? JVM如何找到存储在JAVA_HOME中的javac路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆