Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

javafx - Error invoking method, 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...