JNI GUI, NoSuchMethodError: main
Brought to you by:
grzegok
I'm trying to use the new feature of Launch4j namely JNI GUI, currently without success.
All necessary preconditions are satisfied and build is completed without errors.
I am actually using maven plugin, but I was unable to get any info out of it. I ported my config to standalone version of Launch4j and same thing happend, except this log at launch:
Executing: <path_to_exe>.exe java.lang.NoSuchMethodError: main Exception in thread "main"
Switching to GUI mode makes everything work. I'd be happy to provide any necessary information and test different configurations.
Currently my config looks like this:
Windows 10 (1803), 64-bit
JDK 1.8.191, 32-bit
launch4j.xml:
<?xml version="1.0" encoding="UTF-8"?> <launch4jConfig> <dontWrapJar>false</dontWrapJar> <headerType>jniGui32</headerType> <jar>myjar.jar</jar> <outfile>path_to_exe</outfile> <errTitle></errTitle> <cmdLine></cmdLine> <chdir>.</chdir> <priority>normal</priority> <downloadUrl>http://java.com/download</downloadUrl> <supportUrl></supportUrl> <stayAlive>false</stayAlive> <restartOnCrash>false</restartOnCrash> <manifest></manifest> <icon>path_to_ico</icon> <classPath> <mainClass>my.main.class.path</mainClass> <cp>myjar.jar</cp> </classPath> <jre> <path></path> <bundledJre64Bit>false</bundledJre64Bit> <bundledJreAsFallback>false</bundledJreAsFallback> <minVersion>1.8.0_172</minVersion> <maxVersion>1.8.0_199</maxVersion> <jdkPreference>preferJre</jdkPreference> <runtimeBits>32</runtimeBits> </jre> </launch4jConfig>
I found the reason of the issue. I'm using JavaFX framework and it doesn't enforce you to actually write the main method. So it is indeed is missing in main class, after addition it works like expected.
Last edit: Alexander 2018-11-07