Error: Could not find or load main class

Answered

Hello

 

I try to build a JavaFX application but when i build it and launch it i have

Error: Could not find or load main class fr.bagou.mc.launcher.serverfirst.LauncherMain

So i tried to change files sources, change Application class of the artifact, create a new artifact but that don't work.

If i open the .jar with 7zip i see that there are all class nothing is missing.

In the MANIFEST.MF i have:

Main-Class: fr.bagou.mc.launcher.serverfirst.LauncherMain

so no problem here

I don t understand the problem here

 

 

Can you help me?

0
4 comments
Hi - could you upload your project to https://uploads.jetbrains.com and provide the upload id here? I'll take a look.
0

Hi

Upload id: 2022_10_21_mzSHFuWQKkJH5JZGUZyMLZ (file: ez.zip)

0

The jar is built incorrectly. You need to extract all the dependent jars inside the main jar. See https://stackoverflow.com/a/42200519/104891 for the sample project.

Also, with JavaFX, there is no easy way to create a self contained runnable jar that will work on all the platforms because it also needs to have native dependencies for JavaFX runtime. It will not work via the simple artifact configuration in the IDE.

Please consider using Gradle and https://github.com/dlemmermann/JPackageScriptFX.

0

Okey i tried many thing and at final i see that there are a error in lib i resolved it and now work

0

Please sign in to leave a comment.