ClassNotFoundException after importing library
MaaxGr opened this issue ยท 7 comments
After i have added this library to gradle:
implementation group: 'at.favre.lib', name: 'bcrypt', version: '0.9.0'
build the Project into a JAR and run it
java -jar build/libs/example-0.0.1.jar
i get the following error:
Error: Could not find or load main class io.ktor.server.netty.EngineMain
Caused by: java.lang.ClassNotFoundException: io.ktor.server.netty.EngineMain
If i comment out only your dependency everything is fine.
Seems to be connected to issue #30. If i manually delete everything out of the META-INF Folder (except MANIFEST.MF) everything works again.
I have the same problem โ๏ธ
I have a workaround for this: Download the jars from mavencentral and delete the META-INF Folder. Than throw the library into a libs folder and add the jar from cradle via the local file. Hope it helps @sidneywidmer
@MaaxGr Thx for the hint, that worked ๐ But would be nice if there was a cleaner way.
Yes of course. But just in case you need it know (as I did ๐ )
I think your problem is not from this library rather the usage of Gradle!
Adding implementation
is not enough to make Gradle add the library to the output jar.
You might use https://github.com/johnrengelman/shadow or search with the keyword fat jar
Yeah. I assumed that everyone in this issue knows how to build a fat-jar :D
Nevertheless it don't works for me. Have you tested your solution @LSafer?
No, I didn't ๐
I thought you didn't knew about fat-jars but It seems that the issue isn't about it
About the issue, it might be because there is a dependency of 'bcrypt' itself missing at runtime.