Hello,
I’m trying not to use fat jar as far as it’s getting too big and uploading it every time to the server takes quite a long time. So, I’m building usual jars and copy all the dependencies into separate folder.
Here’s a part of Gradle file
task copyJarToBundle(type: Copy,) {
into "$buildDir/bundle"
from jar
}
task copyLibsToBundle(type: Copy, dependsOn: 'copyJarToBundle') {
into "$buildDir/bundle/libs"
from configurations.runtimeClasspath
}
build.dependsOn(copyLibsToBundle)
I’m launching my jar and specifying classpath to stdlib
:
java -jar myjar-1.0.0.jar -cp "libs/kotlin-stdlib-1.3.10.jar"
But I’m still receiving an error that looks like missing kotlin-runtime
:
Exception in thread "main" java.lang.NoClassDefFoundError: kotlin/jvm/functions/Function1
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetMethodRecursive(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: kotlin.jvm.functions.Function1
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 7 more
Am I missing something?