Just struggled with the same problem and my solution was to run that way:
- Download kotlin’s latest release from here: Releases · JetBrains/kotlin · GitHub - At the time of this post it was “v1.5.20” (the zip file to download is located at the bottom of the page)
- Unzip “kotlin-compiler-1.5.20.zip” it in a place of your choice. Locate the bin folder and copy its path to your environment path (on Windows)
- It should look something like this: your_download_location\kotlinc\bin
- Open your system settings and edit the system environment variable called “PATH” by adding a new entry to it using the located path above - System environment path can be edited on Windows over: System Settings > System and Security > System > Advanced system setting > Environment variables…
- Compile the program using the kotlin compiler command bellow by opening a terminal in the root of this project:
kotlinc src your_project_location/your_project_name/src/main/kotlin/your_main_class.kt -include-runtime -d your_outputname.jar
Example:
kotlinc src c:/repo/myproject/src/main/kotlin/Main.kt -include-runtime -d main.jar
Run Result without args
java -jar main.jar
Run result passing arguments to it
java -jar main.jar arg1 arg2