'In eclipse, I select create runnable jar file, but the file generated is normal jar

I have seen tutorials wherein the generated files properties it is meant to say: executable jar file, however, mine solely says .jar file.

I use JavaFX and scene builder to create a program, as well as MySQL and JDBC with MySQL workbench.

I have attempted to create a batch (.bat) file with the following line: java -jar RecipeMemory.jar, with RecipeMemory being the name of the .jar file I created.

The program runs when executed in the eclipse IDE, however I receive the following errors when attempting to run it in the command prompt.


WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @615227bb'
Graphics Device initialization failed for :  d3d, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
        at com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:283)
        at com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:254)
        at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:264)
        at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:291)
        at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:163)
        at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:659)
        at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:679)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
        at java.base/java.lang.Thread.run(Thread.java:831)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:95)
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
        ... 1 more
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:567)
        at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:61)
Caused by: java.lang.RuntimeException: No toolkit found
        at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:276)
        at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:291)
        at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:163)
        at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:659)
        at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:679)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
        at java.base/java.lang.Thread.run(Thread.java:831)

Research into similar problems has only shown me examples which show this error when run from the IDE and offer solutions to fix the module-info.java file however my file already contains the information included in the solutions I have seen.

I will link my full code in my github.

https://github.com/Pedro105/RecipeTracker.git

note: when I exported the project I set the launch configuration to Main, which was the only option that appeared.



Solution 1:[1]

I am not familiar with eclipse, however I have ran into similar issues deploying apps with Intellij, and most of the issues were caused by altered files upon being exported or missing librairies.

First, make sure that the external libraries your program uses are bundled with your app and are configured correctly when you export the project into a jar file. One solution is to use gradle or maven to handle dependencies and deployment. More info on Maven HERE

Second when exporting the project, and again this applies to Intellij and maven, the MANIFEST.MF file in the META.INF folder sometimes gets corrupted for some reason and doesn't point to the right class. In the IDE it points to your Main class but once exported for some reason unbeknownst to me, it points elsewhere and you have to manually update the file after it is exported. You can use a program like Winrar to check the contents of your jar file and to make sure that every file has the right content.

I made an entire series (Very poor quality) on how to deploy a javaFX app with maven and Intellij because so many people run into the same issues, myself included. The series covers making a runnable .jar file, packaging it into a .exe file with the JRE and dependencies bundled and finally making it into an installer for distribution. You can find it Here

If you want more help we are going to need more info however. I don't think the fact you are using a MySQL database or the JBDC connector is relevant to your issue. Your issue is configuring and exporting your project.

Good luck

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ADSquared