Has anyone had this problem? I can't find the `Mai...
# announcements
n
Has anyone had this problem? I can't find the
MainClass
in the jar I generated with
Gradle
package
r
The main class isn't the issue
The kotlin stdlib is not in your classpath
n
omg
i check it
@randomcat
there still seems to be errors
r
that's not sufficient
n
omg What other dependencies do I need to add?
r
I see you're using the application plugin, you should be using the generated shell script, not the raw jar
run
./gradlew installDist
and look in
build/install
e
that, or just use
./gradlew run
n
image.png
uff
image.png
I am now trying to use
kotlinc mainKt.kt
It seems like it might work this time
­čśşHow do I add dependency parameters to kotlinc?
r
don't, just use a build tool
n
image.png
this is too weird... i was completely unable to successfully package it into a jar using the included gradle
e
your build.gradle needs to state your dependencies
n
yes i do
image.png
Let me demonstrate it from the beginning
r
And which one of those provides
org.jetbrains.kotlin.cli
?
n
what...idk
but i can run my mainKt.kt
i check it
not at all...
image.png
e
https://youtrack.jetbrains.com/issue/KT-41657 some windows jvm are buggy apparently
n
emm
my jdk is
image.png
@ephemient thank you i check it
I also think this is a bug in jdk
look at this
e
no, that is not a bug. the jar only contains your classes, not your whole classpath
that is why you use the script generated by
installDist
n
omg!!!!!!!!
I solved it
1. update gradle to 7.0 2. add shadow
I think it's because I've added other dependencies, so I need to use shadow
e
shadow is almost certainly a workaround for something you should be doing better.
n
image.png
i can run it
@ephemient thank you!
e
don't use
java -jar
.