How to pass arguments to the kotlin command line? ...
# announcements
j
How to pass arguments to the kotlin command line? I cannot find example (https://kotlinlang.org/docs/tutorials/command-line.html) Same as in Java: java exampleClass 5000 java exampleClass 0 < input.txt
k
The Kotlin compiles creates a jar, and you can just run that jar like you'd run any other Java jar.
j
So there is no possibility to execute it like Java?
r
@Jakub Aniola The kotlin runtime is needed to run kotlin application. Probably you could run it with simple "java" command, but you would have to specify a long classpath.
k
The link he's asking about says that's what
-include-runtime
is for.
@Jakub Aniola You execute it exactly like you'd run Java, what do you mean?
i
j
What I was thinking - can I compile it not to jar, just to class and then execute it with arguments? Without buidling to jar, like in the tutorial
k
You can, but then you need to pass the kotlin stdlib in the classpath parameter, and that's more difficult.
👍 1
174 Views