Compiling Kotlin code..!

Compiling Kotlin code..!

Kotlin source code is normally stored in files with the extension .kt. The Kotlin compiler analyzes the source code and generates .class files, just like the Java compiler does. The generated .class files are then packaged and executed using the standard procedure for the type of application you’re working on.

In the simplest case, you can use the kotlinc command to compile your code from the command line and use the java command to execute your code

kotlinc <source file or directory> -include-runtime -d <jar name>java -jar <jar name>

Code compiled with the Kotlin compiler depends on the Kotlin runtime library. It contains the definitions of Kotlin’s own standard library classes and the extensions thatKotlin adds to the standard Java APIs. The runtime library needs to be distributed with your application.

In most real-life cases, you’ll be using a build system such as Maven, Gradle, or Antto compile your code. Kotlin is compatible with all those build systems, In addition, Maven and Gradle take care of including the Kotlin runtime library as a dependency of your application.

要查看或添加评论,请登录

?? Saral Saxena ???????的更多文章

社区洞察

其他会员也浏览了