https://kotlinlang.org logo
#exposed
Title
# exposed
c

codec

08/22/2021, 3:54 AM
why does running jars from the command line with kotlin not include the standard java libraries?
c

CLOVIS

08/22/2021, 10:03 AM
Normal jars don't bundle their dependencies with them (so you can install them separately if you have a package system). You can either use gradle's
distZip
task to get a ZIP with properly configured classpath, or if you really want a single JAR you can use a Uber-Jar generator (for example the ShadowJar Gradle plugin)
👍 1
ł

Łukasz Bednarczyk

08/22/2021, 10:04 AM
I suggest you use ShadowJar
s

subashz

08/23/2021, 7:03 AM
@Łukasz Bednarczyk what's the difference . I am using distZip task for now. Is there any performance hit using this method ?
ł

Łukasz Bednarczyk

08/23/2021, 7:12 AM
@subashz to be honest, I always use ShadowJar, and I have never got any problem.
👍 1
s

subashz

08/23/2021, 7:22 AM
Yeah, found some interesting article after thinking about it. https://devsday.ru/blog/details/50822
c

CLOVIS

08/23/2021, 7:38 AM
@subashz distZip/distTar gives you a run script as well, while ShadowJar expects you to run it with
java -jar
. If you're sending it to an end user, it's probably easier/more native to use those.
ł

Łukasz Bednarczyk

08/23/2021, 8:34 AM
@CLOVIS ok, but in backend app it isn’t so important
2 Views