Use IntelliJ and Kotlin to build a Windows EXE that runs without JVM
1. Start JetBrains Toolbox. Then Select IntelliJ Community.
Then, I get the Welcome to IntelliJ IDEA.
2. Click on New Project.
See the New Project window to configure the new project.
3. Select Kotlin Multiplatform.
Select Native Application.
20 java version "20.0.2"
Name: exampleWinExe
Click Next.
See next window.
4. Uncheck Use kotlin.test
Click Finish.
See project open. It has the "fun main"
with the test code: println("Hello, Kotlin/Native!")
Also see the error "Unsupported class file major version 64"
Shift + F9 (to debug) is unresponsive.
Alt + Shift + F9 brings a popup to select the configurations
(there are no configurations), and an option to Edit.
5. Select the option to Edit.
See "No run configurations added."
6. Click the +
See a list of configurations to add.
7. Click on Kotlin.
See "Error: No main class specified"
Things were already awry on Step 4 with
the message, "Unsupported class file major version 64".
If I selected the wrong project to make a Windows executable (a native app) with source code written in Kotlin, then I don't care about this project. But if I did select the right project, how do I fix it so it works?
Please sign in to leave a comment.
"Indicates that the Java version can be used for compilation and tests, but not yet running Gradle itself."
(https://docs.gradle.org/current/userguide/compatibility.html#kotlin)
For now I recommend you to use versions 17-19.
I went to the link, https://youtrack.jetbrains.com/issue/KTIJ-18968. , but I got a page, "Nope, can't find it!".
Maybe that is because this has been an issue for such a long time.
https://youtrack.jetbrains.com/issue/KTIJ-18968