如何解决Kotlin中的阵列问题? [英] How can i solve the Array problem in Kotlin?

查看:97
本文介绍了如何解决Kotlin中的阵列问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试编译一些基本的数组代码时,我得到了错误.我尝试重新安装IntelliJ,并进行了所有更新.

When I try to compile some basic array code I get errors. I tried to re-install IntelliJ and I made all updates.

fun main(args: Array<String>) {
    val numbers = intArrayOf(1, 4, 42, -3)
    if (4 in numbers) {
        println("numbers array contains 4.")
    }
}

这是错误.

Exception in thread "main" java.lang.NoClassDefFoundError: kotlin/KotlinPackage
    at KtlneKt.main(ktlne.kt:2)
    at KtlneKt.main(ktlne.kt)
    Caused by: java.lang.ClassNotFoundException: kotlin.KotlinPackage
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 2 more

Process finished with exit code 1

推荐答案

相同的问题.相同的答案:我有同样的问题,我发现这是Kotlin库的错误.您不能调用intArrayOf()方法.

Same question. So same answer: I had the same problem and I discovered that this is a bug of Kotlin library. You cannot call intArrayOf() method.

我确定您使用的是 Windows 10单一语言土耳其语. (我使用的是同一操作系统.)Kotlin的某些库无法在土耳其语操作系统上工作.您可以在 YouTrack 上检查此问题.

I am sure that you are using Windows 10 Single Language Turkish. (I was using the same operating system.) Kotlin's some libraries cannot work on Turkish operating system. You can check this issue on YouTrack.

您可以通过安装 Windows 10专业版英语 Windows 10单一语言英语来解决您的问题.我现在不知道任何其他方法. (您可以在Kotlin网站上打开新一期.)

You can solve your problem with installing Windows 10 Pro English or Windows 10 Single Language English. I do not know any other approach right now. (You can open new issue on Kotlin website.)

这个错误从我那儿花了30天.您可以检查有关此Kotlin错误的相关问题.

This bug took from me 30 days. You can check my related question about this Kotlin bug.

这篇关于如何解决Kotlin中的阵列问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆