Kotlin-native: Compiled output file ends with ".kexe" on Windows

Created on 12 Jun 2017  路  9Comments  路  Source: JetBrains/kotlin-native

Hello,

I just downloaded the repo as zip file and followed the instructions and tested the native compiler to see if it is working.

I tried compiling this code:
The file name is HelloWorld.kt:
fun main(args: Array) {
println("Hello, World!")
}

When compiling using the native Kotlin compiler using the command
kotlinc HelloWorld.kt -o HelloWorld

I get a compiled file HelloWord.kexe which will not run unless I rename it to HelloWorld.exe

The version of the Kotlin Native compiler is
info: kotlinc-native 1.1.4-dev-626 (JRE 1.8.0_102-b14)

Is this a feature or a bug?

Most helpful comment

image

All 9 comments

image

@kabrepos
.kexe not a valid Portable Executable(PE),then PELoader cant load and run the .kexe file.
on windows .exe .com .bat can be run,if installed java runtime,also .jar can be run .

@sgf

I don't know what you mean by saying ".kexe not a valid" PE. If you mean it will not run on Windows as an executable file, then this is what I am reporting. Do correct me if I misunderstood. However, if I rename the file from HelloWorld.kexe to HelloWorld.exe then the file runs fine.

Note that it is not I who named the compiled file HelloWorld.kexe, but rather the Kotlin compiler. And also note that I am talking about the native Kotlin compiler not the JVM version (as referenced on the Kotlin webpage). I know that Jar file works in the compiler targeting the JVM, but I am referring here to the native compiler that is supposed to output native executables.

Why is it a feature that a user like me must rename the compiled output to exe, unlike almost all compilers out there which produce exe files directly?

Thanks

Well, if you want you can teach Windows to run .kexe as executable - just add it to pathext environment variable, and run assoc .kexe=exefile

Thank you @msink, I know. I was just curious if it was a bug or feature, and if it was the latter, why, when almost every compiler produces exe files directly.

This will be fixed soon.

@olonho

Thanks. Good to know.

However, if I rename the file from HelloWorld.kexe to HelloWorld.exe then the file runs fine.

msink 's way maybe correct.

Fixed by #665.

Was this page helpful?
0 / 5 - 0 ratings