Ошибка failed to launch jvm

I’m developing a desktop application using javafx v8.0.40. I have created an exe file with inno 5. When I run exe file in my computer, it is installed and run without any problem. On the other hand, when I try to install and run it on some other computer, at the end of installation, window dialog pops up: «Error invoking method», I click Ok. Another window pop up saying «Failed to launch jvm». I searched the whole internet, but I couldn’t find much about this topic. I hope I will get solution to this problem.
Thank you in advance.

asked Oct 22, 2015 at 15:43

tarlan's user avatar

tarlantarlan

1711 gold badge1 silver badge5 bronze badges

3

I ran into the same problem; the following worked for me and helped me make sense of those blasted «Error invoking method.» and «Failed to launch JVM» dialogs:

  1. Find your .jar file
    • It has the same name as your Project and it’s in your application’s installation directory under AppDataLocal{ApplicationTitle}app (shortcut: type %appdata% into explorer); if your project was named HelloWorld, there you will find HelloWorld.jar
  2. Navigate to it’s directory in command prompt
    • shift+Right Click any blank spot in the Explorer window and choose «Open command window here» (that’s a fancy trick I recently learned; alternatively you would cd to the same directory using the command prompt)
  3. Run your .jar via the command line
    • type java -jar "HelloWorld.jar" and hit Enter

Tadah! Behold your hidden exceptions (the existence of which «Error invoking method.» so vaguely tries to communicate to you). *

If your problem is similar to mine it stems from a file structure difference between the project out folder and the installation directory, and that’s why the program compiles just fine in the editor and builds just fine—there isn’t a problem until it’s built out, and the file structure is a little different.

*If you didn’t get anything when you ran it via the command line, look for any errors that could be happening during that initialize() method; that’s where your problem likely is. You can expose any exceptions during runtime by using a Popup Exception Dialog like shown in a similar problem, here.

Community's user avatar

answered Jul 1, 2016 at 22:20

Brad Turek's user avatar

Brad TurekBrad Turek

2,4522 gold badges30 silver badges56 bronze badges

1

This is probably because it lacks the dependencies in the output jar. So you need to add the libraries in the artifact and then .exe generation should be ok.

Here is an example with Intellij, where the libraries have be manually moved from «Available Elements» to the artifact

Intellij example

svarog's user avatar

svarog

9,4174 gold badges61 silver badges77 bronze badges

answered Feb 3, 2016 at 14:03

Rumoch's user avatar

RumochRumoch

611 silver badge5 bronze badges

even though this question is a little old — today I faced the exact same problem and couldn’t find any solution searching for those error messages other then here.

The problem is pretty much identically:
Built JavaFX Application (running fine on dev pc) using java 8 and packaged to native installer (exe) using Inno 5.
Application ran fine on some of our machines — on others it failed with exact those to error messages:

  • «Error invoking method»
    and after clicking OK
  • «Failed to launch jvm».

On application startup, the fxml loader loads the first view controller and calls its «initialize» method. If — within initialize — an unhandeled exception is being thrown, the application crashes and those two windows error messages are shown.

Hope that this will help some one who like me is struggling with that, too.

answered Jun 8, 2016 at 9:58

J.Dürr's user avatar

The response by J.Dürr (answered Jun 8 ’16 at 9:58) helped solve my Error invoking method & Failed to launch JVM issue. I used the following code to track down the issue, which turned out to be an errant FXML resource path:

public static void main(final String[] taArgs)
{
  try
  {
    Main.launch(taArgs);
  }
  catch (Exception e)
  {
    JOptionPane.showMessageDialog(null, e.getMessage());
    try
    {
      PrintWriter pw = new PrintWriter(new File("<somefilename.txt>"));
      e.printStackTrace(pw);
      pw.close();
    }
    catch (IOException e1)
    {
      e1.printStackTrace();
    }
  }
}

answered Oct 10, 2017 at 21:36

Eddie Fann's user avatar

I just had this issue and @Brad Turek’s answer pointed me at the right direction. Except it wasn’t my code that throw the exception.

The .cfg file (at /<app_name>/app/<app_name>.cfg) that the .exe wrapper used to start my application had incorrectly pointed to libs (jar files) that didn’t exist at the /lib directory. Which (I concluded) caused the classloader to throw and terminate the startup.

After correcting the .cfg file everything worked fine.

answered Mar 6, 2019 at 10:17

svarog's user avatar

svarogsvarog

9,4174 gold badges61 silver badges77 bronze badges

I could not fix the problem, but I found a way around it. I used notepad to create a batch file to launch the app. First I used cd to get to the directory of the .jar file and then used java -jar to launch the app. It should look something like this:

cd C:[wherever your project folder is located][name of project]dist
java -jar [name of project].jar

Save it as a .bat file on the desktop, launch the batch file and your program will boot!

answered Aug 17, 2018 at 4:45

Bold Warrior's user avatar

You could experience this error if you didn’t include the third-party libraries to the build.

The following can be placed in the build.xml just before the end tag of the project.

<target name="-post-jfx-deploy">
    <fx:deploy width="${javafx.run.width}" height="${javafx.run.height}" nativeBundles="all"
               outdir="${basedir}/${dist.dir}" outfile="${application.title}">
        <fx:application name="${application.title}" mainClass="${javafx.main.class}"/>
        <fx:resources>
            <fx:fileset dir="${basedir}/${dist.dir}" includes="*.jar"/>       
            <fx:fileset dir="${basedir}/${dist.dir}" includes="lib/*.jar"/>
        </fx:resources>
        <fx:info title="${application.title}" vendor="${application.vendor}"/>
    </fx:deploy>           

answered Feb 19, 2020 at 22:47

Yaw's user avatar

YawYaw

1561 silver badge4 bronze badges

Hello,

I’ve recently installed the most recent version of QuPath (0.2.0-m12) and am getting an error message saying «Failed to launch JVM» when I try to launch the software.

I am opening the software by double clicking on the actual QuPath application, not through opening a .svs file or any other image file.

I had a similar issue when I installed a new-at-the-time vesion of QuPath (0.2.0-m8) but was eventually able to run it through means that I do not recall.

Can anyone please help me out with what could be going wrong? I’ve attached a log from the debug version when I try to open it. I’m not very strong in computer science so unfortunately I could not decipher these hieroglyphics.

-Phil

Qupath Error

Cryptomator Community

Loading

JavaFX IDEA packaged EXE many problems, because less information on the Internet so to sum up here, I hope to help you!

The first is packaged JavaFx:

First, Ctrl + Alt + Shift + S is performed as following:

FIG then performed as follows:

After the rebuild you can find out which folders.

But many procedural problems. Error invoking method and Failed to launch JVM.:

In StackOverFlow above a corresponding question:
https://stackoverflow.com/questions/38001576/error-invoking-method-and-failed-to-launch-jvm-native-package-will-build-but

It means to go to run the jar to see what error. Here’s a summary of issues where possible.

The first problem is that a certain file can not be opened, this very direct, no success will tell you where to read the file, copy into this directory on the line.

The second problem is introduced Intellij IDEA given a push jar packagejava.lang.NoClassDefFoundError This is what I sold off the child in front.
is actually due to the lack dependent jar package, the package is likely to redistribute so.
point just to the right of the jar should move to the right, back on the line Rebuild.


welcome to add questions, I will try to reply! If you have to help Comments welcome!

Подробности
марта 18, 2016
Просмотров: 99359

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

Функции JVM (Java Virtual Machine)

Виртуальная машина java отвечает за выделение памяти и сбор мусора, наряду с интерпретацией байт-кода в машинный код.

Среда выполнения Java (JRE) является обязательным для установки на вашем компьютере для некоторых приложений, чтобы работать должным образом. Основным компонентом JRE является виртуальная машина Java (JVM), которая помогает запускать Java-приложения. Java-файл, при компиляции, производит ‘.класс’ файл, а не исполняемый файл. Этот класс файл содержит байт-код java, который в jvm интерпретируется в машиночитаемые инструкции. Jvm — независит от платформы, поскольку он обеспечивает машинный интерфейс, который не зависит от базовой операционной системы и аппаратной архитектуры.

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

 Сообщение об ошибке #1: не удалось создать виртуальную машину java.

Это сообщение об ошибке обычно возникает при попытке запуска Java-игр, таких как minecraft.

➦Откройте панель управления.

➦Зайти в систему.

➦Перейти к расширенным свойствам системы.

➦Нажмите кнопку ‘переменные среды’.

➦В системных переменных, нажмите кнопку ‘новый’.

➦Поставьте новое имя переменной: _JAVA_OPTIONS

➦Вбейте новое значение переменной: -Xmx512M

➦Нажмите кнопку ‘ОК’.

-Xmx/S-это параметр конфигурации, который управляет количеством памяти которое использует java.

  • Xmx — это максимальный размер памяти, которая может быть выделена.
  • Xms — это минимальный размер памяти, которая может быть выделена.

 Сообщение об ошибке #2: ошибка при открытии раздела реестра.

Эта ошибка может возникнуть при работе с Java в командной строке.

➦Открываем папку WINDOWSsystem32.

➦Удаляем исполняемый файл java файлов, в том числе java.exe, javaw.exe и javaws.exe.

➦Далее переустанавливаем среду JRE.

  Сообщение об ошибке #3: Виртуальная машина java лаунчер не может найти основной класс: программа завершает работу

➦Нажмите кнопку «Пуск» в главном меню.

➦В окне поиска введите «mrt» и нажмите клавишу Enter. Будет запущена утилита Windows под названием ‘Средство удаления вредоносных программ Microsoft Windows ‘.

➦Нажмите кнопку «Далее» и выберите «полное сканирование».

➦Перезагрузите компьютер после завершения сканирования.

➦Нажмите кнопку «Пуск» и запустить программу настройки системы, набрав команду «msconfig» в поле поиска.

➦ Перейдите на вкладку «запуска» и снимите галочку рядом с ‘WJView.exe’ и ‘javaw.exe’.

➦Перезагрузитесь при запросе.

 Сообщение об ошибке #4: не удалось открыть jarфайл.

Эта ошибка может возникнуть при попытке открыть приложение.

➦Нажмите кнопку ‘Пуск’ и перейдите к ‘программам по умолчанию’.

➦Выберите «сопоставление типа файла или протокола программе’.

➦Нажмите на расширения (.jar) для просмотра программы, которая открывает его по умолчанию.

➦Нажмите кнопку «изменить программу» и выбрите программу по умолчанию «виртуальная машина java лаунчер».

➦Нажмите кнопку «закрыть» и проверьте, устранена ли проблема.

➦Если нет, попробуйте удалить и переустановить Java.

➦Если проблема не устранена, обратитесь в техническую поддержку приложения, которое дает вам ошибку.

Если вы столкнулись с еще какими-либо ошибками Java Virtual Machine напишите о них в комментариях, постараюсь помочь.

Ссылки:

Загрузить Java бесплатно с официального сайта

Читайте также

Понравилась статья? Поделить с друзьями:
  • Ошибка failed to launch game
  • Ошибка failed to launch exe
  • Ошибка failed to launch denuvo license generator
  • Ошибка failed to launch client
  • Ошибка failed to initialize как исправить