Questions tagged [kotlinc]

Kotlin Compiler - Comes bundled with standard Kotlin package

Compile the application using the Kotlin compiler.

$ kotlinc hello.kt -include-runtime -d hello.jar

The -d option indicates what we want the output of the compiler to be called and may be either a directory name for class files or a .jar file name. The -include-runtime option makes the resulting .jar file self-contained and runnable by including the Kotlin runtime library in it. If you want to see all available options run

$ kotlinc -help

Run the application.

$ java -jar hello.jar

61 questions
1
vote
1 answer

Does JVM use kotlinc for Kotlin?

I do have a little question about JVM and Kotlin. The JVM uses the Javac compiler to compile the Java code to bytecode. How does this work for Kotlin? Will the JVM use the Kotlinc compiler or will it still use the Javac compiler as Kotlin can be…
Iliasvw
  • 11
  • 1
  • 3
0
votes
1 answer

No output when compiling kotlin-js IR using kotlinc cli

I'm trying to compile a kotlin file test.kt using kotlinc-js: fun main() { println("Hello world!") val a = add(7, 22) println("Added to get $a") } fun add(x: Int, y: Int): Int { val z = x + y println(z) println("Hello $y") …
0
votes
0 answers

How to get Kotlinc 1.8.0 to run with Ubuntu on Windows

I installed Kotlinc through the zip file kotlin-compiler-1.8.0.zip and extracted it and moved the kotlinc\bin files to my C:\Program files. I later then verified that I had installed it correctly by running the kotlinc -version command in the…
benji
  • 13
  • 3
0
votes
0 answers

kotlin ir symbol owner meaning and how to find ir lr related concept

There seems no documentation for ir related concept. Is there any documentation for ir related concept? How should I understand ir symbol owner for example. I understand it roughly but not well. Thanks.
Molly Tian
  • 53
  • 6
0
votes
1 answer

lookup and verify sha256 for kotlinc in bazel

I try migrating from Maven to Bazel and want to use another (newer) version of kotlinc than the standard default. I have started from the example given on …
Christian Fuchs
  • 430
  • 3
  • 9
0
votes
1 answer

kotlinc vs kotlinc-jvm to compile and kotlin vs java to run

I have just installed Kotlin version 1.7.0 and the bin folder has the following runnables. kotlinc kotlin-jvm kotlin After quick check found that kotlinc and kotlin-jvm are used to compile code to bytecode just like javac in Java. Why there are 2…
srk
  • 4,857
  • 12
  • 65
  • 109
0
votes
0 answers

Kotlin - IntelliJ cannot resolve the reference (from synthetic class)

I am using Kotlin and I have the kotlinc compiler plugin (using arrow-meta library) in place which changes the .class by adding for example new properties or new method etc during kotlin compilation time. for example, the original source Kotlin A.kt…
0
votes
1 answer

Kotlin mandatory explicit annotation parameter names? @Foo(>>bar<< = 42)

How to make Kotlin Annotation parameter's name explicit declaration mandatory? // Having an annotation class Foo annotation class Foo(val bar: String) // This declaration should work // we explicitly provided parameter name @Foo(bar = "42") class…
Sergei Rybalkin
  • 3,337
  • 1
  • 14
  • 27
0
votes
1 answer

Kotlinc include other jar files

I would like to run an app from the command line on MacOS. The problem is that I want to include Gson in the file to convert my data classes into a json object. (I'm new to command line with kotlin) To simplify, I use the following: fun main() { …
Ilias
  • 210
  • 3
  • 11
0
votes
1 answer

Kotlin compile java 12 and kotlin inside Eclipse or command line

I tried to create a simple Kotlin command line app import java.RegistroJ class Main fun main(){ var registro:RegistroJ? = RegistroJ() registro?.setCognome("Baudo") registro?.setNome("Pippo") var registro2:RegistroJ = RegistroJ() …
LiefLayer
  • 977
  • 1
  • 12
  • 29
0
votes
1 answer

Suppress Java warning when running kotlinc

Every time I run kotlinc i get a warning: Java HotSpot(TM) 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release. How do I stop this from happening?
EpicLagg
  • 13
  • 2
0
votes
0 answers

Include files and directories in Kotlin Jar file on the command line

How can I include resources in a kotlin jar file created on the command line? With java I can just do jar cfm File.jar manifest.txt File.class resource.txt resourceDirectory In Kotin on the command line we can use kotlinc -d File.jar file.kt to…
0
votes
1 answer

Is Apples goto-bug possible in Kotlin if-statement without braces?

Imagine in Kotlin: if (this) doThis() else if(that) doThat() else doWhatEver() I've read using braces always (see Apples goto fail)! Rule 1.3.a Braces shall always surround the blocks of code (a.k.a., compound statements), following if, else,…
Noam Silverstein
  • 819
  • 2
  • 12
  • 18
0
votes
1 answer

Documentation for the XML format for files referenced from the kotlinc -Xbuild-file argument

Where is the documentation for the XML format for the contents of files referenced from the kotlinc -Xbuild-file argument? The XML looks something like:
XDR
  • 4,070
  • 3
  • 30
  • 54
0
votes
1 answer

Gradle not more detail for ':compileKotlin'

I'm new on gradle and kotlin When i build syntax error file using gradle build it's just show Execution failed for task ':compileKotlin'. > Compilation error. See log for more details How do i get which line syntax error like using kotlinc? PS:…
Benny Leung
  • 133
  • 1
  • 3
  • 10