我最近尝试使用Kotlin/native将CLI工具从JVM转换为本机可执行文件。我得到了以下错误(这是有道理的(:
> Task :compileKotlinMain FAILED
e: C:test1srcmainkotlincliCommandLineTool.kt: (4, 8): Unresolved reference: java
e: C:test1srcmainkotlincliCommandLineTool.kt: (5, 8): Unresolved reference: java
e: C:test1srcmainkotlincliCommandLineTool.kt: (6, 8): Unresolved reference: java
e: C:test1srcmainkotlincliCommandLineTool.kt: (9, 14): Unresolved reference: System
e: C:test1srcmainkotlincliCommandLineTool.kt: (9, 27): Unresolved reference: System
e: C:test1srcmainkotlincliCommandLineTool.kt: (12, 20): Unresolved reference: InputStream
e: C:test1srcmainkotlincliCommandLineTool.kt: (12, 38): Unresolved reference: PrintStream
e: C:test1srcmainkotlincliCommandLineTool.kt: (16, 57): Unresolved reference: BufferedReader
e: C:test1srcmainkotlincliCommandLineTool.kt: (19, 80): Unresolved reference: PrintStream
e: C:test1srcmainkotlincliCommandLineTool.kt: (19, 100): Unresolved reference: BufferedReader
支持Java的控制台I/O的替代方案是什么?有这个图书馆吗?非常感谢。
print编写其单个arugment标准输出。它是重载方法,可以采用Any?
或任何基元类型。
readLine从标准输入读取。它没有参数,并返回String?
。
这两个都来自kotlin.io包,这是一个"用于处理文件和流的io API"。