[Solved] Ubuntu Install jdk Error: Error occurred during initialization of VM

1. First make sure the environment variables are configured correctly.
2. Then make sure there is tools.pack and rt.pack in the directory where jdk is located, take the directory /usr/java/jdk1.8.0_221-amd64 where jdk1.8.0_221-amd64 is located as an example, make sure there is tools.pack under /usr/java/jdk1.8.0_221-amd64/lib .pack, and make sure that rt.pack is available under /usr/java/jdk1.8.0_221-amd64/jre/lib.
3. Use the tool unpack200 under /usr/java/jdk1.8.0_221-amd64/bin to extract tools.pack and rt.pack to tools.jar and rt.jar respectively,
This is done using the command line as follows.
[email protected]:/usr/java/jdk1.8.0_221-amd64/jre/lib# …/bin/unpack200 rt.pack rt.jar
[email protected]:/usr/java/jdk1.8.0_221-amd64/lib# …/bin/unpack200 tools.pack tools.jar

Read More: