简体   繁体   中英

How to solve could not create the virtual machine error of Java Virtual Machine Launcher?

I am working on java wicket framework and Apache tomcat. When I tried to start tomcat, it shows Java Virtual Machine Launcher pop window "Could not create the Java Virtual Machine".

After clicking on "OK" button on Pop window, it shows the error on console.

Error occurred during initialization of VM.
Could not reserve enough space for object heap.

Please give me any reference or suggestions.

Error:

sony@sony-VPCEH25EN:~$ java --version
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 
Unrecognized option: --version
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Solution: Remove extra hyphen '-'

sony@sony-VPCEH25EN:~$ java -version
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

I was also facing this issue when we upgraded from java 8 to java 10. I solved by removing

-Djava.endorsed.dirs="C:\Program Files\Apache Software Foundation\Tomcat 8.5\endorsed"

from the argument.

  • Press Windows+Pause keys simultaneously to open the "System" window. You can alternatively open the control panel manual to go there if you prefer it that way. Click on "Advanced system settings" on the left then click "Advanced" tab.
  • Select environmental variables here.
  • Click on new under System Variables.
  • Enter '_JAVA_OPTIONS' as the variable name.
  • Enter '-Xmx1024M' as the variable value.
  • Click ok twice.

Edit your Catlina.bat so that your -Xmx settings are less than your physical memory

See Tomcat 7: How to set initial heap size correctly?

Add the system variable _JAVA_OPTIONS and in the "new variable value" add "-Xmx1024M".

Xmx sets the maximum heap memory size

I was facing the same issue while I was using "jdk-10.0.1_windows-x64_bin" and eclipse-jee-oxygen-3a-win32-x86_64 on Windows 64 bit Operating System.

I resolved this issue by changing my jdk to "jdk-8u172-windows-x64". Now it's working fine.

The error does not say much and lot of things can be wrong. One thing that was wrong in my case was following

-x.DargName=108352123

Which is clearly wrong and should have been

-Dx.argName=108352123

I was facing the same issue while I was using JDK 1.8.0_05 64 bit and eclipse-jee-oxygen-3a-win32-x86_64 on Windows 64 bit Operating System.

在此处输入图像描述

I resolved the issue by changing JDK version jdk1.8.0_05 to jdk1.8.0_172

For me it was picking the default JVM v6 set in env vars.

Needed to explicitly add below in eclipse.ini to use v8 which is req by photon.

-vm
C:\Program Files\Java\jdk1.8.0_75\bin\javaw.exe
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.8

NOTE : Add the entry of vm above the vm args else it will not work!

You just need to add JAVA_HOME to your environment variable. Just point this variable to jdk location(not the jdk bin location) as shown in the below image. 在此处输入图像描述

在此处输入图像描述

If none of the other options works, then this could be an issue with the version of the JDK itself, just uninstall the current jdk and install the latest version.

I also faced this issue. After trying everything, I upgraded to the latest JDK and this issue was resolved on its own.

I was facing the same issue when I was using tomcat 8.5 with Java 10 . I installed Java 8(1.8.0_171) and it's working fine without any issues.

在 ubuntu(版本 18)上,一些应用程序支持 java 8 而不支持 java 11。如果是这种情况,您可以按照以下主题的说明切换到 java 8: https ://askubuntu.com/questions/1133216/ 降级-java-11-to-java-8

I had to add an older jdk on my project.

Right button on Project folder > Properties > Java Build Path > Libraries > Add Library > JRE System Library

在此处输入图像描述

在此处输入图像描述

In case you don't have the package for jdk8, download the jdk that some user mentioned above ( http://download.oracle.com/otn-pub/java/jdk/8u172-b11/a58eab1ec242421181065cdc37240b08/jdk-8u172-windows-x64.exe ) and click on "Installed JREs" and search for the directory you downloaded the jdk8.

在此处输入图像描述

Then click on Finish.

Remove the apache server and add again.

The magic is done ;)

I had the same issue today when running the ancient software Dundjinni , a mapping tool, on Windows 10. (Dundjinni requires a rather old installation of Java; I haven't tried updating Java, for fear the programme will fail.) My method was to simply run Dundjinni in administrator mode. Here is how:

Click Start or press the Start key, navigate down to the software, rightclick the programme, choose More, then choose Run as administrator. Note that this option is not available if you simply type the name of the software.

在此处输入图像描述

-Open Installed version of TomcatX.exe from the tomcat lib folder

-From the Tomcat9 Properties screen, select the Java Tab

-Remove the line "-Djava.endorsed.dirs=XXXXXX"

-Select the General Tab and click on the Start button to Restart Tomcat

I am working on java wicket framework and Apache tomcat. Here I have Problem when i tried
to start tomcat it shows Java Virtual Machine Launcher pop window "Could not create the
Java Virtual Machine".
After clicking on "OK" button on Pop window it shows the error on console.

Error occurred during initialization of VM.
Could not reserve enough space for object heap.

Please give me any reference or suggestions.
Thanks in Advance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM