Am using JNI_CreateJavaVM to embed a VM in my application. But i want to allow users to set switch between "hotspot", "classic" and "server". How does java.exe and javaw.exe implement this?
- "HKEY_LOCAL_MACHINESOFTWAREJavaSoftJava Runtime Environment" has a CurrentVersion key. If the value of this key is "1.3.1", then "HKEY_LOCAL_MACHINESOFTWAREJavaSoftJava Runtime Environment1.3.1JavaHome" has the directory where this version of JRE is installed (say "C:Program FilesJavaSoftJRE1.3.1").
Relative to this path a file called "jvm.cfg" in directory "lib" is read. This file contains a list of available JVM versions. On my machine this file contains three lines:
-hotspot -server -classic
- If the user has specified one of the availabe VMs with -version, then that one is chosen, otherwise the VMs are chosen in the order they're specified in the file.
- The VM that was selected, say "hotspot", is started by appending "binhotspotjvm.dll" to the JavaHome directory and by using the invocation functions in that dll.
You can find the details in java.c and java_md.c (present in src.jar, that is shipped with the SDK).