java JRE里面JVM的路径是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29486755/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 15:22:19  来源:igfitidea点击:

What is the path of the JVM inside the JRE?

java

提问by Anoop Butola

I am just learning Java and I wanted to know that everywhere its written that JVM present inside JRE. I just wanted to know the complete path where exactly JVM is present inside JRE.

我只是在学习 Java,我想知道 JRE 中到处都写着 JVM。我只是想知道 JRE 中确切存在 JVM 的完整路径。

回答by TheLostMind

In Windows : inside your JRE, you will have a folder like this : C:\Program Files (x86)\Java\jre7\bin\client--> this directory contains the client JVM jvm.dll.

在 Windows 中:在您的 JRE 中,您将有一个这样的文件夹:C:\Program Files (x86)\Java\jre7\bin\client--> 该目录包含客户端 JVM jvm.dll

Under :linux you will find it in /jreInstallation/lib/yourSystemArchtecture(amd64 in my case)/(server/client)/libjvm.so

在 :linux 下你会发现它 /jreInstallation/lib/yourSystemArchtecture(amd64 in my case)/(server/client)/libjvm.so

A VM is nothing but a shared library like dllor sofile. Your java exe or other executable file calls the jvm.

虚拟机只不过是一个共享库,如dllso文件。您的 java exe 或其他可执行文件调用 jvm。

Note : You can call your JVM using any language / executable file/ You could write a shell scriptor a cobol program to execute the JVM

注意:您可以使用任何语言/可执行文件调用您的 JVM/您可以编写shell 脚本或 cobol 程序来执行 JVM

回答by xorcus

If you intend to use the Invocation APIin a native application and access Java APIs installed as part of OpenJDK (Java 10, Java 11, etc.) in ${JAVA_HOME}directory, link against (or dynamically load) jvm.dllfound in ${JAVA_HOME}/bin/server/jvm.dll.

如果您打算在本机应用程序中使用Invocation API并访问作为 OpenJDK 的一部分安装的 Java API(Java 10、Java 11 等)${JAVA_HOME},请链接(或动态加载)jvm.dll${JAVA_HOME}/bin/server/jvm.dll.

Oracle installers (currently up to Java 8) add a Windows Registry key pointing to jvm.dll. For example, when JRE 8 is installed, the following key is added:

Oracle 安装程序(目前最高为 Java 8)添加了一个指向jvm.dll. 例如,在安装 JRE 8 时,添加以下键:

HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.8

HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.8

and it contains a string value RuntimeLibset to absolute path to jvm.dll. Also, information that 1.8is the CurrentVersioncan be found in key:

并且它包含一个RuntimeLib设置为绝对路径的字符串值jvm.dll。此外,这些信息1.8CurrentVersion可以在关键发现:

HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment

HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment

As of Java 9, Oracle abbreviatedJava Runtime Environmentto JRE, so the keys are: HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\JRE HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\JRE\9

从 Java 9 开始,Oracle缩写Java Runtime EnvironmentJRE,因此键为: HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\JRE HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\JRE\9

This is all documented Windows Registry Settings section of the installation guide.

这是安装指南的所有记录的Windows 注册表设置部分

回答by Sumit Singh

For Debian and Ubuntu, it is under

对于 Debian 和 Ubuntu,它位于

/usr/lib/jvm/

For windows where javaworks for me to list all java exe but java -verbosetells you which rt.jar is used and thus which jre (full path):

对于 Windows where java,我可以列出所有 java exe,但会java -verbose告诉您使用了哪个 rt.jar 以及哪个 jre(完整路径):

回答by Ted

Windows 10, mine: C:\Users\elb>where java

Windows 10,我的:C:\Users\elb>where java

C:\ProgramData\Oracle\Java\javapath\java.exe

c:\Program Files\Java\jdk1.7.0_07\bin\java.exe