- Determine Version and Path of your Java Virtual Machine
- 1. Determine Path and Version of the actual default JVM used by the System
- 2. Determine the Version of any JVM on the System
- 3. Determine Path and Version of a JVM at Runtime
- 4. Determine Path and Version of a running JVM or Processes
- Don’t forget to…
- A final note
- Java Virtual Machine (JVM) Download & Install for Windows 10/8/7
- What Is a Java Virtual Machine (JVM)
- Is JVM the Same as JRE and JDK
- Java Virtual Machine Download & Install for Windows 10/8/7
- About The Author
Determine Version and Path of your Java Virtual Machine
When starting any Java applications you usually don’t need any knowledge about the underlying JVM and its installation path. But some days ago a collegue was confronted with a very delicate problem regarding the usage of the default truststores of different installed JVMs on a host machine that call each other. To find the truststore in charge we had to find the right JVM. So let’s sum up how to determine your JVMs in different cases:
1. Determine Path and Version of the actual default JVM used by the System
Open a console window and type:
You will get something like:
[Loaded java.lang.Void from C:\Program Files\Java\jre1.8.0_31\lib\rt.jar] [Loaded java.lang.IllegalAccessException from C:\Program Files\Java\jre1.8.0_31\lib\rt.jar] [Loaded sun.misc.PostVMInitHook from C:\Program Files\Java\jre1.8.0_31\lib\rt.jar] java version "1.8.0_31" Java(TM) SE Runtime Environment (build 1.8.0_31-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode) [Loaded java.lang.Shutdown from C:\Program Files\Java\jre1.8.0_31\lib\rt.jar] [Loaded java.lang.Shutdown$Lock from C:\Program Files\Java\jre1.8.0_31\lib\rt.jar]
Its very important that you type the -verbose option first, otherwise you will only get the version information.
2. Determine the Version of any JVM on the System
Open a console window, navigate to the path of each JVM and type:
You will get something like:
java version "1.8.0_31" Java(TM) SE Runtime Environment (build 1.8.0_31-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)
It’s very important to specify the current directory ./ if you are using the Windows Powershell or a Linux console window. If you don’t specify the current directory, the default JVM will be called and you will get the version of the default JVM instead of the JVM of the current directory.
3. Determine Path and Version of a JVM at Runtime
To get the the information at runtime, put the following code into the source code of your application or call this in debug mode:
System.getProperty("java.home"); System.getProperty("java.version");
4. Determine Path and Version of a running JVM or Processes
To gather the same information out of running processes that you can’t stop, for example running production servers, you can use the jps command (https://docs.oracle.com/javase/8/docs/technotes/tools/unix/jps.html) and jcmd utility (https://docs.oracle.com/javase/8/docs/technotes/tools/unix/jcmd.html). Both are part of the JDK and not part of simple JRE.
But before getting the path and version you first have to determine the process-ids of the java processes of your interest. Your first idea may be to call the tasklist command on Windows systems or ps command on Unix-like systems. But if you call them, you will get a meaningless list of processes like:
javaw.exe 11940 Console 1 61.400 K javaw.exe 12484 Console 1 36.992 K javaw.exe 7088 Console 1 714.736 K
Instead use the JPS command against a remote machine:
or the JCMD command to show the names of the running local processes:
If you do so, you will get a nice list of running processes:
11940 com.sun.jme.toolkit.bootstrap.Container 12484 com.sonyericsson.sdkme.proxy.GUI 8580 sun.tools.jcmd.JCmd -l 7088 C:\Program Files\eclipse-3.7.2\\plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar -os win32 -ws win32 -arch x86_64 -showsplash -launcher C:\Program Files\eclipse-3.7.2\eclipse.exe -name Eclipse --launcher.library C:\Program Files\eclipse-3.7.2\\plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502\eclipse_1406.dll -startup C:\Program Files\eclipse-3.7.2\\plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar --launcher.overrideVmargs -exitdata 3328_104 -product org.eclipse.epp.package.reporting.product -vm C:/Program Files/Java/jdk1.7.0_21/bin/javaw.exe -vmargs -Dosgi.requiredJavaVersion=1.5 -Xms40m -Xmx512m -XX:MaxPermSize=256m -jar C:\Program Files\eclipse-3.7.2\\plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
Grab the PID of the process of your interest and put it into the jcmd command:
>>> jcmd 7088 VM.system_properties
You will get an overwhelming list of all system properties with version and path as well. If you are only interested in the version it’s more sufficient to take the option VM.version instead of VM.system_properties .
Don’t forget to…
… call all of these commands with the corresponding user who is running the processes. So if you want to investigate the processes of a usual Tomcat instance at Linux, first get the user who started up the processes:
Take the user and run your command with user rights:
>>> sudo -u tomcat8 jcmd 7088 VM.system_properties
A final note
Maybe you already read about the where command on Windows:
>>> where java C:\ProgramData\Oracle\Java\javapath\java.exe C:\Windows\System32\java.exe C:\Program Files\Java\jdk1.6.0_33\bin\java.exe
And also you may read about the which command in Linux environments:
Both commands only show the paths of registered java executables. If you have installed more than one JDK or JRE, you only get paths of the latest installed executables. So this can be a little bit missleading, but in some situations they may lead you to the default installation paths as well as described in the first bullet point.
Java Virtual Machine (JVM) Download & Install for Windows 10/8/7
What is a Java Virtual Machine? A lot of users are confused about it and don’t know where to get the Java Virtual Machine download pack. In this post, MiniTool will explain the definition of JVM and provide a full download/install guide.
Java, developed by Oracle Corporation, is one of the most popular programming languages that is widely used for desktop computers, android development, games, and other development tasks. However, many users find there are different components of the Java program like JRE, JDK, and JVM.
What is JVM? Is JVM the same as JDK and JRE? How to download and install Java Virtual Machine for Windows 10/8/7? Keep reading the content below.
Where to find the Notepad++ download package? How to install Notepad++ for Windows 10/8/7 PCs? Now, this post will explain all these questions in detail.
What Is a Java Virtual Machine (JVM)
Java Virtual Machine, also known as JVM, is a virtual environment that allows a computer to run Java programs written in other programming languages that are translated to Java bytecode. That is to say, JVM works as an interpreter that can load, verify, and executes Java bytecode.
In addition, JVM is also responsible for converting Java bytecode to machine-specific code. In addition, it is platform-dependent and can perform many tasks like memory management and security. Java Virtual Machine mainly consists of the following 3 components or subsystems.
- Runtime Data Areas: It is responsible for providing memory to store bytecode, objects, parameters, local variables, return values, and intermediate results of computations. It mainly contains PC register sets, method areas, stack areas, and threads.
- Class Loader Subsystem: It is an essential core of the JVM and can be used for loading/reading/linking the “. Class” files and saving the Java bytecode in the JVM method area.
- Execution Engine: It is the central component of the JVM and can communicate with various memory areas of the JVM. It executes the bytecode assigned to the Runtime Data Areas in JVM via the Class Loader.
What is JVM? Now, I believe that you already have known the answer. Let’s see where to get the Java Virtual Machine download pack.
Is JVM the Same as JRE and JDK
Is JVM the same as JRE and JDK? A lot of users are confused about the difference between JRE vs JDK vs JVM. JRE (Java Runtime Environment) is a software distribution that provides an environment for a Java program or app using the Java command. It is mainly used for those who only want to execute Java programs that are end-users of the system.
JDK is short for Java Development Kit which is a software development environment used for developing and executing Java programs, while JVM is responsible for loading, verifying, and executing Java bytecode. In addition, JVM is necessary for both JDK and JRE and Java programs won’t run without it. If the JVM component of Java programs gets corrupted or missing, you may encounter some errors like “a Java Virtual Machine is required” and “Minecraft could not create the java virtual machine”.
What is NET Framework 3.0? Where to download NET Framework 3.0? How to install it for Windows? This post will explain these questions for you in detail.
Java Virtual Machine Download & Install for Windows 10/8/7
How to get the Java Virtual Machine downloaded and installed for Windows 10/8/7. Although Oracle doesn’t provide a single Java Virtual Machine installer, the JVM installation package is included in JDK or Java downloads.
So, you can download the Java Virtual Machine installer by getting the Java JDK package from Oracle. For that:
Step 1. Click here to open the Oracle Java Downloads page, and navigate to the Windows tab. There are 3 links to JDK installers and you can select one according to your need.
Step 2. Once downloaded, double-click the JDK executable file and click on Yes to run it.
Step 3. Click on Next and follow the on-screen prompt to complete the JVM installation.
Further reading: If you encounter some issues like the C drive full when installing the program, MiniTool Partition Wizard can help you fix them easily. Moreover, you can use it to extend/resize/format partition, convert a disk to MBR/GPT, migrate OS, etc.
About The Author
Ariel has been working as a highly professional computer-relevant technology editor at MiniTool for many years. She has a strong passion for researching all knowledge related to the computer’s disk, partition, and Windows OS. Up till now, she has finished thousands of articles covering a broad range of topics and helped lots of users fix various problems. She focuses on the fields of disk management, OS backup, and PDF editing and provides her readers with insightful and informative content.