且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

什么是JAVA_HOME? JVM如何找到存储在JAVA_HOME中的javac路径?

更新时间:2023-01-14 22:41:28

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.