How to import Java packages into Kotlin Native

I am trying to import a Java package for use in my native Kotlin, as shown below:

/* main.kt */
import java.util.*

fun main(args: Array<String>) {
    print("Simple program")
}

and compile it with the following command

kotlinc main.kt -o main

I got an error message

main.kt:2:8: error: unresolved reference: java
import java.util.*

Obviously, I need to show kotlinc where java.util can be found, how can I achieve this without using the command line? I am on Windows 10 64 bit using native Kotlin 0.3.

+4
source share
1 answer

Java Kotlin Native. , Kotlin , Java ( ). C. , .

Kotlin/Native:

, Kotlin/JVM Kotlin/Native Kotlin/JS. JVM, . : , .

+9

Source: https://habr.com/ru/post/1680520/


All Articles