This article mainly studies the jvm.cfg file of openjdk.
# List of JVMs that can be used as an option to java, javac, etc. # Order is important -- first in this list is the default JVM. # NOTE that this both this file and its format are UNSUPPORTED and # WILL GO AWAY in a future release. # # You may also select a JVM in an arbitrary location with the # "-XXaltjvm=<jvm_dir>" option, but that too is unsupported # and may not be available in a future release. # -server KNOWN -client IGNORE
For jdk8, the file is under JAVA_HOME/jre/lib/ directory; Its comments show that the configuration file is used to configure option that java and javac can use, in which the configuration order is very important. the first is default JVM (
Whether it is KNOWN or IGNORE；; IGNORE simply disables vmoption; ERROR will report an error and display not supported.)； You can see here that -server is the default and -client is ignored.
-server KNOWN -client IGNORE
For jdk9, 10, 11 and 12, the file is under JAVA_HOME/lib/ directory
Set -client to default
For jdk12, move -client to the front.
-client IGNORE -server KNOWN
Execute java -version as follows
java -version Error: missing `client' JVM at `/Library/Java/JavaVirtualMachines/jdk-12.jdk/Contents/Home/lib/client/libjvm.dylib'. Please install or use the JRE or JDK that contains these missing components.
You can see that for jdk12 of mac, setting client to default will report an error.
-server KNOWN -client ERROR
Executing java -client -version displays the following
java -client -version Error: client VM not supported
As you can see, if the setting -client is ERROR, an error will be reported and not supported will be displayed.
java -version Error: could not open `/Library/Java/JavaVirtualMachines/jdk-12.jdk/Contents/Home/lib/jvm.cfg'
You can see that if jvm.cfg is deleted, executing java -version will report an error.
- The jvm.cfg file is used to configure option that java and javac can use. the configuration order is very important. the first is default JVM (
Whether it is KNOWN or IGNORE；; IGNORE simply disables vmoption; ERROR will report an error and display not supported.)
- For jdk8, the file is under JAVA_HOME/jre/lib/ directory; For jdk9, 10, 11 and 12, the file is in JAVA_HOME/lib/ directory; If you delete the jvm.cfg file, executing the java command will report an error
- You can see that -server is in front of -client in jvm.cfg of mac’s open jdk, -server is default JVM, and -client is ignored