Java error could not create the java virtual machine linux

facing some problem with java virtual machine initialization. when i am using root account i can properly work with java. but when i am a user account it returns following errors user@host# $JAVA_...

facing some problem with java virtual machine initialization. when i am using root account i can properly work with java. but when i am a user account it returns following errors

user@host# $JAVA_HOME/bin/java -version
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

It does not seems like a memory issue as the same command works with root account. Available memory (free -m) is more than 1200MB
Also i have tried increasing the JVM memory limits

asked Mar 27, 2012 at 14:17

Uday Sawant's user avatar

9

Just be careful. You will get this message if you try to enter a command that doesn’t exist, e.g.:

/usr/bin/java -v

Max von Hippel's user avatar

answered Sep 19, 2012 at 23:16

2

I had this issue today, and for me the problem was that I had allocated too much memory:

-Xmx1024M -XX:MaxPermSize=1024m

Once I reduced the PermGen space, everything worked fine:

-Xmx1024M -XX:MaxPermSize=512m

I know that doesn’t look like much of a difference, but my machine only has 4GB of RAM, and apparently that was the straw that broke the camel’s back. The Java VM was failing immediately upon every action because it was failing to allocate the memory.

answered Aug 17, 2012 at 22:44

john_science's user avatar

john_sciencejohn_science

6,2576 gold badges42 silver badges59 bronze badges

Set the JVM memory:

export _JAVA_OPTIONS=-Xmx512M

answered Mar 6, 2014 at 23:46

lashgar's user avatar

lashgarlashgar

4,9823 gold badges35 silver badges44 bronze badges

The problem got resolved when I edited the file /etc/bashrc with same contents as in /etc/profiles and in /etc/profiles.d/limits.sh and did a re-login.

answered Aug 18, 2012 at 10:20

Uday Sawant's user avatar

Uday SawantUday Sawant

5,6583 gold badges32 silver badges45 bronze badges

1

Make sure the physical available memory is more then VM defined min/max memory.

answered Apr 6, 2015 at 17:39

dilip dhiran's user avatar

facing some problem with java virtual machine initialization. when i am using root account i can properly work with java. but when i am a user account it returns following errors

user@host# $JAVA_HOME/bin/java -version
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

It does not seems like a memory issue as the same command works with root account. Available memory (free -m) is more than 1200MB
Also i have tried increasing the JVM memory limits

asked Mar 27, 2012 at 14:17

Uday Sawant's user avatar

9

Just be careful. You will get this message if you try to enter a command that doesn’t exist, e.g.:

/usr/bin/java -v

Max von Hippel's user avatar

answered Sep 19, 2012 at 23:16

2

I had this issue today, and for me the problem was that I had allocated too much memory:

-Xmx1024M -XX:MaxPermSize=1024m

Once I reduced the PermGen space, everything worked fine:

-Xmx1024M -XX:MaxPermSize=512m

I know that doesn’t look like much of a difference, but my machine only has 4GB of RAM, and apparently that was the straw that broke the camel’s back. The Java VM was failing immediately upon every action because it was failing to allocate the memory.

answered Aug 17, 2012 at 22:44

john_science's user avatar

john_sciencejohn_science

6,2576 gold badges42 silver badges59 bronze badges

Set the JVM memory:

export _JAVA_OPTIONS=-Xmx512M

answered Mar 6, 2014 at 23:46

lashgar's user avatar

lashgarlashgar

4,9823 gold badges35 silver badges44 bronze badges

The problem got resolved when I edited the file /etc/bashrc with same contents as in /etc/profiles and in /etc/profiles.d/limits.sh and did a re-login.

answered Aug 18, 2012 at 10:20

Uday Sawant's user avatar

Uday SawantUday Sawant

5,6583 gold badges32 silver badges45 bronze badges

1

Make sure the physical available memory is more then VM defined min/max memory.

answered Apr 6, 2015 at 17:39

dilip dhiran's user avatar

Some users are encountering the Could Not Create The Java Virtual Machine error when trying to launch an application that is using Java. This particular issue is reported to occur with Minecraft and several other applications that are built around Java.

Could not create the Java Virtual Machine. Error: A fatal exception has occured. Program will exit.

Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. The program will exit.

What is causing the Could Not Create The Java Virtual Machine error?

We investigated this particular issue by looking at various user reports and the troubleshooting strategies that they used to resolve the same error message. Based on their conclusions, there are a couple of scenarios that will trigger this particular issue:

  • Java is invoked by the wrong arguments or options – This can occur if you’re running a home-brewed application or you’re trying to open an open-source application that is known to cause system instability.
  • Java global maximum heap memory is not high enough – One of the most common causes of why you can encounter this particular error is if you try to start a Java application with a maximum heap memory size larger than the one set as the System Variable.
  • Java executable and/or application require administrative privileges – This might happen with applications that need admin access in order to function properly.

If you’re currently looking for a way to resolve the, Could Not Create The Java Virtual Machine error, this article will provide you with several verified troubleshooting strategies. Below you have a collection of methods that other users in a similar situation have used to get the issue resolved.

To ensure the best results, follow the methods below in the order that they are presented until you discover a method that is effective in resolving the error for your particular scenario.

Method 1: Adding the _JAVA_OPTIONS to System Variables

Most affected users have managed to get the issue resolved by creating a System Variable for Java called _JAVA_OPTIONS and setting it’s value to Xmx512M. What this essentially does is it sets the global maximum heap memory size for Java.

This will resolve any error message that occurs because the started Java application’s maximum heap memory size is larger than the one set as the System Variable. Several users encountering the same issue have reported that the issue was resolved entirely after they performed the steps below.

Here’s what you need to do to add a _JAVA_OPTIONS entry in System Variables to enlarge the global maximum heap memory size:

  1. Press Windows key + R to open up a Run dialog box. Then, type “sysdm.cpl” and press Enter to open up the System Properties screen.
  2. Inside the System Properties screen, go to the Advanced tab and click on Environment Variables.
  3. In the Environment Variables window, click on New (under System Variables).
  4. Inside the New System Variable window, set the Variable name to _JAVA_OPTIONS and the Variable value to –Xmx512M and click Ok to save the changes.
  5. Close the previously opened windows and restart your machine to enforce the changes.
  6. At the next startup, open the application that was previously showing you the Could Not Create the Java Virtual Machine error and see if is now functioning properly.

Creating a System Variable called _JAVA_OPTIONS and assigning it the value Xmx512M

Creating a System Variable called _JAVA_OPTIONS and assigning it the value Xmx512M

If you’re still seeing the same error message at the start of the application, try adding the Java Bin path which might be similar to “%USER PATHJavajdk1.6.0_39bin” to the environment variable as indicated in the above method and see if that works.

Method 2: Opening java.exe with admin rights 

Several users struggling to resolve the same issue have managed to get the issue resolved after forcing the main Java executable (java.exe) to open with administrative privileges.

Some users reported that they were able to resolve the issue after applying this fix on both the main java executable and the executable of the application that is showing the error message.

Here’s a quick guide through the whole thing:

  1. Open File Explorer and navigate to the location of your java installation. We’ll need to arrive at the location of the main Java executable (java.exe). By default, you should find it in Program Files/Java/*JRE build version*/bin. The exact location will differ depending on which Java Runtime Environment you’re using.Navigate to the location of java.exe
    Navigate to the location of java.exe

    Note: If you installed Java in a custom location, navigate the custom location instead.

  2. Right-click on java.exe and choose Properties. Then, go to the Compatibility tab and check the box associated with Run this program as an administrator (under Settings). Click Apply to save the changes.go to Compatibility tab and enable Run this program as an administrator
    go to the Compatibility tab and enable Run this program as an administrator
  3. Right-click on the application executable (the one that is triggering the error) and repeat the same procedure: Compatibility > Run this program as an administrator > Apply.
  4. Run the application and see if the error message is resolved.

Method 3: Reinstalling Java

In some cases, the error is triggered because Java might not be installed properly or its installation might have been corrupted over time. Therefore, in this step, we will be reinstalling Java after uninstalling it completely. For that:

  1. Press Windows key + R to open up the Run prompt and type in “Appwiz.cpl”.
    Type “appwiz.cpl” into the Run dialog and press Enter
  2. Press “Enter” and the Programs and Features screen will open up.
  3. At the Programs and Features screen, scroll through the installed application list until you find Java.
    Checking the Programs and features screen
  4. Right-click on it and select “Uninstall” to remove it completely from the system
  5. First, delete the primary Java installation and later you should also remove all other Java installations such as updates and other versions.
  6. After uninstalling all installation, restart your computer.
  7. After booting up, visit this link and download the latest version of JRE.
  8. Check to see if the issue persists.
  9. If the error still persists, download and install the latest version of JDK from here.
    Note: If you are already using JDK, try changing its versions or uninstalling the JRE that has been installed along with it.
  10. Verify if the issue still exists.

Method 4: Fixing Errors With Code

There are different reasons behind this error and some of them include if you have some particular errors with your code. We will highlight some below.

  • Remove Hyphen: Some users noted that the error was fixed by changing the double hyphen “–” to a single one “-” in their code. For example:
    Change the code
    “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.”
    To
    “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.”
  • Also, Try removing the following line from your argument
    -Djava.endorsed.dirs=”C:Program FilesApache Software FoundationTomcat 8.5endorsed”
  • Open your eclipse.ini file and make sure that you add the “-vm” entry above the vm args otherwise, JVM V6 will be selected in env vars.
  • If on Ubuntu, you should know that Java 8 is the only version that is supported. Therefore, using the third method. Uninstall Java, and install the previous version.

Method 5: Editing Eclipse.ini File

We can also tweak things inside the Eclipes.ini File to get rid of this issue. There might be a couple of issues with its configuration that need to be addressed therefore, we have divided it into separate issues. Follow the one which suits your scenario the best.

Lowering Memory Use

  1. Open the Eclipse.ini file inside the Eclipse folder with notepad.
  2. Find the line similar to “-Xmx256m” (It might be -Xmx1024m or -Xmx 512m).
  3. Now change the default value to a more reasonable figure depending upon the RAM installed on your computer and add the version number to it as well. For Example:
    -Xmx512m
    -Dosgi.requiredJavaVersion=1.6
    OR
    -Xmx512m
    -Dosgi.requiredJavaVersion=1.7
    OR
    -Xmx512m
    -Dosgi.requiredJavaVersion=1.8
  4. Also, try removing the “256m” value from the “-launcher.XXMaxPermSize” line.
  5. Check to see if the issue persists.

Tinkering Around

  1. Try to remove the following lines from your file.
    -vm P:Programsjdk1.6bin
  2. Also, change the following lines.
    set -Dosgi.requiredJavaVersion=1.5
    TO
    set -Dosgi.requiredJavaVersion=1.6
  3. Also, try adding the following line above “-vmargs!” line.
    -vm C:Program Files (x86)Javajre6binjavaw.exe
  4. Also, point to JVM.dll using the following line.
    -vm
    C:Program FilesJavajre7binclientjvm.dll
  5. Open the Eclipse file and replace “-vmargs” with the path of javaw.exe. For Example:
    -startup
    plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
    --launcher.library
    plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20120522-1813
    -product
    com.android.ide.eclipse.adt.package.product
    --launcher.XXMaxPermSize
    256M
    -showsplash
    com.android.ide.eclipse.adt.package.product
    --launcher.XXMaxPermSize
    256m
    --launcher.defaultAction
    openFile
    **-vm “c:Program FilesJavajdk1.7.0_07binjavaw.exe”** 
    -Dosgi.requiredJavaVersion=1.6
    -Xms40m
    -Xmx768m
    -Declipse.buildId=v21.1.0-569685
  6. Also, you can place the following line at the end and check if that works.
    -vmargs
    -Xms40m
    -Xmx512m
    -XX:MaxPermSize=256m
  7. Furthermore, try removing the following lines from the eclipse.ini and check if that works.
    -XX:+UseStringDeduplication
    -XX:+UseG1GC
  8. You can also try removing the eclipse.ini file if the issue still persists as that has reportedly fixed the issue for some but remember to back it up first just in case you need it. Also, try closing all the power-hungry applications before starting Java to make sure proper resources are available.

Checking for JDK Corruption

  1. Press “Windows” + “R” to open the Run prompt and type in “cmd”.
  2. Type in the following command and check if that gives an error.
    c:> java -version
  3. If it does give an error, reinstall the JDK completely.

Photo of Kevin Arrows

Kevin Arrows

Kevin is a dynamic and self-motivated information technology professional, with a Thorough knowledge of all facets pertaining to network infrastructure design, implementation and administration. Superior record of delivering simultaneous large-scale mission critical projects on time and under budget.

Содержание

  1. Fix: Could Not Create the Java Virtual Machine
  2. What is causing the Could Not Create The Java Virtual Machine error?
  3. Method 1: Adding the _JAVA_OPTIONS to System Variables
  4. Method 2: Opening java.exe with admin rights
  5. Method 3: Reinstalling Java
  6. Method 4: Fixing Errors With Code

Fix: Could Not Create the Java Virtual Machine

Some users are encountering the Could Not Create The Java Virtual Machine error when trying to launch an application that is using Java. This particular issue is reported to occur with Minecraft and several other applications that are built around Java.

error message 5Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. The program will exit.

What is causing the Could Not Create The Java Virtual Machine error?

We investigated this particular issue by looking at various user reports and the troubleshooting strategies that they used to resolve the same error message. Based on their conclusions, there are a couple of scenarios that will trigger this particular issue:

If you’re currently looking for a way to resolve the, Could Not Create The Java Virtual Machine error, this article will provide you with several verified troubleshooting strategies. Below you have a collection of methods that other users in a similar situation have used to get the issue resolved.

To ensure the best results, follow the methods below in the order that they are presented until you discover a method that is effective in resolving the error for your particular scenario.

Method 1: Adding the _JAVA_OPTIONS to System Variables

Most affected users have managed to get the issue resolved by creating a System Variable for Java called _JAVA_OPTIONS and setting it’s value to Xmx512M. What this essentially does is it sets the global maximum heap memory size for Java.

This will resolve any error message that occurs because the started Java application’s maximum heap memory size is larger than the one set as the System Variable. Several users encountering the same issue have reported that the issue was resolved entirely after they performed the steps below.

Here’s what you need to do to add a _JAVA_OPTIONS entry in System Variables to enlarge the global maximum heap memory size:

If you’re still seeing the same error message at the start of the application, try adding the Java Bin path which might be similar to “%USER PATHJavajdk1.6.0_39bin” to the environment variable as indicated in the above method and see if that works.

Method 2: Opening java.exe with admin rights

Several users struggling to resolve the same issue have managed to get the issue resolved after forcing the main Java executable (java.exe) to open with administrative privileges.

Some users reported that they were able to resolve the issue after applying this fix on both the main java executable and the executable of the application that is showing the error message.

Here’s a quick guide through the whole thing:

Method 3: Reinstalling Java

In some cases, the error is triggered because Java might not be installed properly or its installation might have been corrupted over time. Therefore, in this step, we will be reinstalling Java after uninstalling it completely. For that:

Method 4: Fixing Errors With Code

There are different reasons behind this error and some of them include if you have some particular errors with your code. We will highlight some below.

Источник

There are many computer applications developed based on Java. When users run these applications, they are supposed to run smoothly.

However, in some instances, errors can pop up and terminate the launch of the respective software. This is usually happening by displaying the error message that starts with ‘could not create the Java virtual machine …’.

If you see this message, the next thing you will experience is that the Java program is stopped. Well, have you ever experienced this error ‘could not create the Java virtual machine …’ error? If so, this article explains the fixes to it. So, read on.

Could Not Create The Java Virtual Machine error

What Causes the ‘Could Not Create The Java Virtual Machine’ Error?

There are several causes behind this issue. Mentioned below are some of those reasons.

  • If Java is invoked with the wrong arguments
    Or if you use unstable software (be it a game or any other app), this issue can occur.
  • If Java global maximum heap memory is not high enough
    This is among the most common causes for sure. In this case, you will have to allocate more memory to resolve the issue.
  • If Java executable file and application is not granted administrative privileges
    To solve this, you should provide administrative privileges.

Besides, if you are bothered by the issue of could not find or load the main class, click to fix it now.

How to Fix the ‘Could not create the Java virtual machine’ Error?

As emphasized in the first paragraph of this article, we are going to explain how to fix this error. In fact, there are multiple solutions to this error, so you should pick the most appropriate one for you. Let’s read on.

Fix 01: Configure a New System Variable

Configuring a new system variable for Java is our first solution to this error. The ‘Could not create the Java virtual machine’ error actually appear when there is not enough memory for it.

In other words, Java requires a substantial amount of memory, and when there is not enough memory, it stops. That means some of the machines that have larger memory capacity experience this issue rarer compared to other machines.

Some of the users have found a solution to this issue simply by expanding the RAM allocated to Java.

Well, to allocate more memory to Java, you may try the following steps and get it done. We use this option as the first method because it is a very easy process.

Steps to Configure a New System Variable

  • As the first step, you should open the ‘Run’ command on your computer. To do this, there are a couple of ways. You can simultaneously hit the Window key and the ‘R’ key on the keyboard to get the ‘Run’ dialog box opened. If not, you can hit the Windows key and type ‘Run‘ in the search box, and select the ‘Run’ option.
  • No matter which method you select, just go to ‘Run.’ Once the ‘Run‘ dialog box is opened, you will see a search bar as well. In this search bar, enter the text’ sysdm.cpl‘. Then, press the button labeled ‘OK.’ You will now see a different window. This Window will comprise the title ‘System Properties.’
Fix Could Not Create The Java Virtual Machine by Configure a new system variable
  • On this Window called ‘System Properties,’ you should select the ‘Advanced‘ tab. Under this option, you will find a button called ‘Environment Variables.’ This will lead you to another window.
  • Click on the option ‘New,‘ located under ‘System variables.’
  • Now, you should enter ‘_JAVA_OPTIONS.’ This should be entered inside the Variable name text box.
  • Afterward, you should enter ‘_Xmx512M‘ within the Variable value text box. Well, this option will increase RAM allocation by 512 megabytes.
  • To complete the process, you should click the ‘OK’ button.
  • You can also press the ‘OK’ button on the ‘Environmental Windows.’
  • That’s it, and 512MB RAM will be allocated.

Fix 02: Make ‘Run’ as an Administrator Option for Java

If the previous option doesn’t work for you, you will have to try a different option. If it doesn’t work, the error might be something else.

In fact, ‘Could not create the Java virtual machine …’ can occur due to insufficient admin rights to Java. Using Windows 10, you can fix the issue using the following steps.

  • In Windows 10, you should open Cortana. To do this, you should hit Windows Key with the ‘Q’ key on the keyboard.
  • Now, you will see a search box appearing. In this box, enter ‘Java.’
  • Then, you will be able to see the ‘Java‘ option. Right-click on this option and then select the option called ‘Open File Location.’
Run Java with administrator to Fix Could Not Create The Java Virtual Machine
  • This option will open the folder of Java in the File Explorer window.
  • You can now go to the java.exe file and then right-click on it. You will then be able to select the ‘Properties’ option.
  • Then select the tab labeled ‘Compatibility.’
  • After selecting the ‘Compatibility‘ option, you should select ‘Run this program as an administrator.
  • To complete the process, you should select the option ‘Apply.’
  • Click ‘OK‘ so you can finish the process.

Fix 03: Install Java Once Again

If none of the above options have worked so far, the cause of the issue might be something different.

So, as another remedy, you should try reinstalling Java and check if it resolves the issue. After reinstalling Java, you can expect the ‘Could not create the Java virtual machine‘ error to be gone.

So, to get it done, you should first uninstall the existing version of Java. For that, you must go to the control panel of the machine. To access the control panel, there are several options you can consider.

For instance, you can either choose a long way or a shortcut. As we believe, entering the text ‘appwiz.cpl.’ within the ‘Run’ box is the most convenient way.

Steps to Reinstall Java

  • Then, in the search box, you should enter ‘Java.’ If not, you can simply scroll down until you find the Java option.
  • Now, select the ‘Java’ option and click on ‘Uninstall.’
  • You may now click on ‘Yes’ on the confirmation box, which will pop up.
  • Now, restart the Windows computer after the installation.
  • Open a web browser of your preference and go to the Java download page.
  • Make sure you choose the appropriate software version for the operating system running on your computer. For instance, if you have a 32-bit Windows OS, you should choose the 32-bit Java file. However, if the operating system runs on 64-bit, you should choose the 64-bit version accordingly. If you are doubtful about the version, you may try installing both Java files. To do this, you should go to the Windows Offline file.
  • Whether you have selected the 32-bit version or the 64-bit version, you must now open the Java setup wizard.
  • Click on the option labeled ‘Install,’ which appears as a button on this setup wizard you have just launched.
Reinstall Java to fix Could Not Create The Java Virtual Machine

That is exactly how to fix the ‘Could not create the Java virtual machine ….’ Issue. This is also known as Java Virtual Machine fatal error.

As we believe, the resolutions we have mentioned above can address this issue for good. Once the issue is fixed, you can run the required Java software without any issues.

This website uses cookies to ensure you get the best experience on our website

Некоторые пользователи сталкиваются с ошибкой «Не удалось создать виртуальную машину Java» при попытке запустить приложение, использующее Java. Сообщается, что эта конкретная проблема возникает с Minecraft и несколькими другими приложениями, построенными на Java.

Не удалось создать виртуальную машину Java.  Ошибка. Произошло фатальное исключение.  Программа будет закрыта.

Что вызывает ошибку «Не удалось создать виртуальную машину Java»?

Мы исследовали эту конкретную проблему, изучив различные отчеты пользователей и стратегии устранения неполадок, которые они использовали для устранения одного и того же сообщения об ошибке. Основываясь на их выводах, существует несколько сценариев, которые могут вызвать данную проблему:

  • Java вызывается из-за неправильных аргументов или опций. Это может произойти, если вы запускаете самодельное приложение или пытаетесь открыть приложение с открытым исходным кодом, которое, как известно, вызывает нестабильность системы.
  • Глобальный максимальный размер кучи Java недостаточно высок. Одна из наиболее частых причин, по которой вы можете столкнуться с этой конкретной ошибкой, — это попытка запустить приложение Java с максимальным размером памяти кучи, превышающим тот, который задан как системная переменная .
  • Исполняемый файл Java и / или приложение требуют прав администратора — это может происходить с приложениями, которым для правильной работы требуется доступ администратора.

Если вы в настоящее время ищете способ устранить ошибку « Не удалось создать виртуальную машину Java» , эта статья предоставит вам несколько проверенных стратегий устранения неполадок. Ниже приведен набор методов, которые другие пользователи в аналогичной ситуации использовали для решения проблемы.

Чтобы обеспечить наилучшие результаты, следуйте приведенным ниже методам в том порядке, в котором они представлены, пока не найдете метод, эффективный для устранения ошибки для вашего конкретного сценария.

Метод 1: добавление _JAVA_OPTIONS в системные переменные

Наиболее затронутым пользователям удалось решить проблему, создав системную переменную для Java с именем _JAVA_OPTIONS и установив для нее значение Xmx512M . По сути, это устанавливает глобальный максимальный размер кучи для Java.

Это устранит любое сообщение об ошибке, возникающее из-за того, что максимальный размер кучи запущенного приложения Java больше, чем тот, который задан как системная переменная. Несколько пользователей, столкнувшихся с той же проблемой, сообщили, что проблема была полностью решена после того, как они выполнили указанные ниже действия.

Вот что вам нужно сделать, чтобы добавить запись _JAVA_OPTION S в системные переменные для увеличения глобального максимального размера кучи:

  1. Нажмите клавишу Windows + R, чтобы открыть диалоговое окно « Выполнить ». Затем введите « sysdm.cpl » и нажмите Enter, чтобы открыть экран « Свойства системы» .
  2. На экране « Свойства системы» перейдите на вкладку « Дополнительно » и нажмите « Переменные среды».
  3. В окне « Переменные среды» нажмите « Создать» (в разделе « Системные переменные» ).
  4. В окне « Новая системная переменная» установите для имени переменной значение _JAVA_OPTIONS и значение переменнойXmx512M и нажмите « ОК», чтобы сохранить изменения.
  5. Закройте ранее открытые окна и перезагрузите компьютер, чтобы изменения вступили в силу.
  6. При следующем запуске откройте приложение, которое ранее показывало ошибку « Не удалось создать виртуальную машину Java», и посмотрите, правильно ли работает.

Создание системной переменной с именем _JAVA_OPTIONS и присвоение ей значения Xmx512M

Если вы все еще видите то же сообщение об ошибке в начале приложения, попробуйте добавить путь Java Bin, который может быть похож на «% USER PATH Java jdk1.6.0_39 bin», к переменной среды, как указано в описанный выше метод и посмотрите, работает ли он.

Метод 2: открытие java.exe с правами администратора

Нескольким пользователям, пытающимся решить одну и ту же проблему, удалось решить проблему после принудительного открытия основного исполняемого файла Java (java.exe) с правами администратора.

Некоторые пользователи сообщили, что им удалось решить проблему после применения этого исправления как к основному исполняемому файлу Java, так и к исполняемому файлу приложения, в котором отображается сообщение об ошибке.

Вот краткое руководство по всему этому:

  1. Откройте проводник и перейдите к месту установки Java. Нам нужно будет добраться до места расположения основного исполняемого файла Java ( java.exe ). По умолчанию вы должны найти его в Program Files / Java / * JRE build version * / bin. Точное расположение будет отличаться в зависимости от того, какую среду выполнения Java вы используете.Перейдите к местоположению java.exe

    Примечание. Если вы установили Java в произвольном месте, перейдите в это место.

  2. Щелкните правой кнопкой мыши java.exe и выберите « Свойства» . Затем перейдите на вкладку « Совместимость » и установите флажок « Запускать эту программу от имени администратора» (в разделе «Настройки»). Нажмите Применить, чтобы сохранить изменения.перейдите на вкладку «Совместимость» и включите «Запускать эту программу от имени администратора».
  3. Щелкните правой кнопкой мыши исполняемый файл приложения (тот, который вызывает ошибку) и повторите ту же процедуру: Совместимость> Запустить эту программу от имени администратора> Применить .
  4. Запустите приложение и посмотрите, исчезнет ли сообщение об ошибке.

Метод 3: переустановка Java

В некоторых случаях ошибка возникает из-за того, что Java могла быть установлена ​​неправильно или ее установка могла быть повреждена с течением времени. Следовательно, на этом этапе мы переустановим Java после ее полного удаления. Для этого:

  1. Нажмите клавишу Windows + R, чтобы открыть окно «Выполнить», и введите «Appwiz.cpl».
  2. Нажмите «Enter», и откроется экран «Программы и компоненты».
  3. На экране « Программы и компоненты» прокрутите список установленных приложений, пока не найдете Java.
  4. Щелкните его правой кнопкой мыши и выберите «Удалить», чтобы полностью удалить его из системы.
  5. Сначала удалите основную установку Java, а позже вы также должны удалить все другие установки Java, такие как обновления и другие версии.
  6. После удаления всей установки перезагрузите компьютер.
  7. После загрузки перейдите по этой ссылке и загрузите последнюю версию JRE.
  8. Проверьте, сохраняется ли проблема.
  9. Если ошибка не исчезла, загрузите и установите последнюю версию JDK отсюда.

    Примечание. Если вы уже используете JDK, попробуйте изменить его версию или удалить JRE, установленную вместе с ним.

  10. Убедитесь, что проблема все еще существует.

Метод 4: исправление ошибок с помощью кода

У этой ошибки есть разные причины, и некоторые из них включают в себя определенные ошибки в вашем коде. Мы выделим некоторые из них ниже.

  • Удаление дефиса : некоторые пользователи отметили, что ошибка была исправлена ​​путем замены двойного дефиса «-» на одинарный «-» в их коде. Например:

    Измените код

    «Sony @ sony-VPCEH25EN: ~ $ java –версия

    Подобрал JAVA_TOOL_OPTIONS: -javaagent: /usr/share/java/jayatanaag.jar

    Нераспознанный вариант: –версия

    Ошибка: не удалось создать виртуальную машину Java.

    Ошибка: возникла фатальная исключительная ситуация. Программа будет закрыта.»

    Чтобы

    «Sony @ sony-VPCEH25EN: ~ $ java -version

    Подобрал JAVA_TOOL_OPTIONS: -javaagent: /usr/share/java/jayatanaag.jar

    Нераспознанный вариант: –версия

    Ошибка: не удалось создать виртуальную машину Java.

    Ошибка: возникла фатальная исключительная ситуация. Программа будет закрыта.»

  • Кроме того, попробуйте удалить следующую строку из своего аргумента

    -Djava.endorsed.dirs = «C: Program Files Apache Software Foundation Tomcat 8.5 endorsed»

  • Откройте файл eclipse.ini и убедитесь, что вы добавили запись «-vm» над аргументами vm, иначе JVM V6 будет выбран в переменных env.
  • Если вы используете Ubuntu, вы должны знать, что Java 8 — единственная поддерживаемая версия. Поэтому пользуемся третьим способом. Удалите Java и установите предыдущую версию.

Метод 5: редактирование файла Eclipse.ini

We can also tweak things inside the Eclipes.ini File to get rid of this issue. There might be a couple of issues with its configuration that need to be addressed therefore, we have divided it into separate issues. Follow the one which suits your scenario the best.

Lowering Memory Use

  1. Open the Eclipse.ini file inside the Eclipse folder with notepad.
  2. Find the line similar to “-Xmx256m” (It might be -Xmx1024m or -Xmx 512m).
  3. Now change the default value to a more reasonable figure depending upon the RAM installed on your computer and add the version number to it as well. For Example:
    -Xmx512m -Dosgi.requiredJavaVersion=1.6 OR -Xmx512m -Dosgi.requiredJavaVersion=1.7 OR -Xmx512m -Dosgi.requiredJavaVersion=1.8
  4. Also, try removing the “256m” value from the “-launcher.XXMaxPermSize” line.
  5. Check to see if the issue persists.

Tinkering Around

  1. Try to remove the following lines from your file.
    -vm P:Programsjdk1.6bin
  2. Also, change the following lines.
    set -Dosgi.requiredJavaVersion=1.5 TO set -Dosgi.requiredJavaVersion=1.6
  3. Also, try adding the following line above “-vmargs!” line.
    -vm C:Program Files (x86)Javajre6binjavaw.exe
  4. Also, point to JVM.dll using the following line.
    -vm C:Program FilesJavajre7binclientjvm.dll
  5. Open the Eclipse file and replace “-vmargs” with the path of javaw.exe. For Example:
    -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20120522-1813 -product com.android.ide.eclipse.adt.package.product --launcher.XXMaxPermSize 256M -showsplash com.android.ide.eclipse.adt.package.product --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile **-vm “c:Program FilesJavajdk1.7.0_07binjavaw.exe”** -Dosgi.requiredJavaVersion=1.6 -Xms40m -Xmx768m -Declipse.buildId=v21.1.0-569685
  6. Also, you can place the following line at the end and check if that works.
    -vmargs -Xms40m -Xmx512m -XX:MaxPermSize=256m
  7. Furthermore, try removing the following lines from the eclipse.ini and check if that works.
    -XX:+UseStringDeduplication -XX:+UseG1GC
  8. Вы также можете попробовать удалить файл eclipse.ini, если проблема не устранена, поскольку, как сообщается, проблема была устранена для некоторых, но не забудьте сначала создать резервную копию на случай, если она вам понадобится. Кроме того, попробуйте закрыть все энергоемкие приложения перед запуском Java, чтобы убедиться в доступности необходимых ресурсов.

Проверка на повреждение JDK

  1. Нажмите «Windows» + «R», чтобы открыть окно «Выполнить», и введите «cmd».
  2. Введите следующую команду и проверьте, выдает ли она ошибку.
    c: > java -версия
  3. Если выдает ошибку, полностью переустановите JDK.

If Java is installed correctly on your computer, you should never have any problem running Java-based applications or games.

However, if there’s something wrong with your setup, you may see the error, “Could not create the Java Virtual Machine.” This error means that the Java installation on your computer can’t launch the virtual sandbox (virtual machine) within which it would typically launch the Java app.

In this guide, you’ll learn a few fixes that can eliminate this error, starting with the most common fix to the less likely solution.

Make Sure Java Is Installed Correctly

Before you can troubleshoot any Java errors, you’ll need to ensure that you’ve installed Java correctly.

To do this, open the command prompt by selecting the Start menu, typing cmd, and selecting the Command Prompt app.

In the command prompt window, type java – version and press Enter.

If Java is installed correctly, you should see the version of Java, the SE Runtime Environment, and the Client VM build.

If you don’t have the latest version, you’ll want to make sure to install it. If this looks good, you’re ready to move on to the next troubleshooting step.

Expand Available System Memory for Java

The most common cause for the “Could not create the Java Virtual Machine” error is that Java doesn’t have enough available memory on your system to launch the VM client.

Java is initially set by default to use an initial and maximum “heap size.” So, if you’re running any application that goes beyond the maximum size, it will trigger an error.

You can adjust this by changing the amount of system memory Java can use on your system. 

1. Select the Start menu and type environmental variables. Select Edit the System Environment Variables

2. In the System Properties window, select Environment Variables.

3. Under the System Variables pane, select New.

4. Set the Variable name as _JAVA_OPTIONS and set the Variable value as -Xmx512M

5. Select OK, and then select OK again.

This adjusts the allowable memory for Java to 512 Mb. The setting change takes effect immediately, so relaunch your Java app and see if the error still appears. If it does, repeat the process above but increase the memory to 1024 Mb by setting the value to -Xmx1024M instead.

Run Java As Administrator

Sometimes virtual machine errors can be caused by the lack of appropriate admin rights on your Windows PC. To see if this is the issue, set up the Java app on your PC to run as the system administrator.

1. Select the Start button and type Java. Select the right arrow next to it and select Open file location.

2. Right-click the Java executable file and select Properties.

3. Select the Compatibility tab and enable the Run the program as an administrator checkbox.

Select OK. Now, the next time Java runs, it will have full administrator rights.

Uninstall and Reinstall Java

Finally, if all else has failed, you may just have a faulty installation of Java.

1. Select the Start menu, type add or remove programs, and select Add or remove programs system settings.

2. In Apps & Features, scroll down to Java, select it, and select Uninstall.

3. Select Yes to confirm, and once Java is fully uninstalled, restart Windows.

4. Download the latest version of Java for your system. Make sure you choose 32 bit if your system is 32 bit or 64 bit if your PC is 64 bit. If you’re not sure which system you have, make sure to check your system type first. 

5. Double click the installation file after downloading. Select the Install button to launch the Java installation process.

Walk through the rest of the wizard, and once the Java installation is complete, restart your Windows system.

Hopefully, you could clear the error in the first few steps and didn’t have to reinstall Java. However, reinstalling Java is a quick enough process and should get your Java apps running smoothly again.

Were there any other fixes you discovered that also worked with this error? Share them with us in the comments section below!

I’m trying to run a file on a vps with 384mb of ram, If I run the file with this command on terminal

java -jar server.jar 

It just starts the process but with only 180mb approx allocated to it, I need to allocate all the ram avaiable, if not the server will end crashing. I run the command free -m and I get this output:

                 total       used       free     shared    buffers     cached
Mem:           384         58        325          6          0         44
-/+ buffers/cache:         14        369
Swap:           96          0         96

So I’ve tried lots of commands with different amounts of ram like those but no one worked, java could not create the java virtual machine:

java -Xms32M -Xmx256M -jar minecraft_server.jar

I tried putting the maximum ram, half and changing values but it gives error. Before I was running the same file on a 1GB vps and that command was working fine:

java -Xmx1024M -Xms1024M -jar bukkit.jar

My java version is:

    java version "1.7.0_55"
OpenJDK Runtime Environment (IcedTea 2.4.7) (7u55-2.4.7-1ubuntu1)
OpenJDK Client VM (build 24.51-b03, mixed mode)

My OS is Ubuntu Server 12.04 x86
Hope you can help me, I’m stuck with the same problem two days

EDIT: Error messages with different amounts of ram

    root@vps-dot-me:~# java -Xms32M -Xmx384M -jar mine.jar
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

root@vps-dot-me:~# java -server -Xms128M -Xmx256M -jar mine.jar
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

    root@vps-dot-me:~# java -XX:MaxHeapSize=256m -jar mine.jar
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Понравилась статья? Поделить с друзьями:
  • Jam 0511 ошибка kyocera
  • Java error code 143
  • Jam 0501 ошибка kyocera
  • Java error cannot find symbol ioexception
  • Java error cannot access class