[英]Attempting To Run Kotlin Project In IntelliJ Idea But Getting Bug Error
My Previous Question + More我的上一个问题 + 更多
I am trying to start learning Kotlin, and I have installed IntelliJ Idea from JetBrains, I really like the layout of the IDE, and so I don't really want to change it.我正在尝试开始学习 Kotlin,并且我已经安装了 JetBrains 的 IntelliJ Idea,我真的很喜欢 IDE 的布局,所以我真的不想改变它。
Whenever I try to run the program, I get the following error:每当我尝试运行该程序时,都会出现以下错误:
Could not open init generic class cache for initialization script 'C:\Users\Jacob\AppData\Local\Temp\wrapper_init1.gradle' (C:\Users\Jacob\.gradle\caches\6.6.1\scripts\9x7j38tmeo1ohlyu8452ntfdm).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 60
I know it's not the code, and since I am not very familiar with IntelliJ Idea or Kotlin, I have no idea where to start looking for the error or where to fix it...我知道这不是代码,而且由于我对 IntelliJ Idea 或 Kotlin 不是很熟悉,我不知道从哪里开始查找错误或从哪里修复它......
Someone said that this question's answers were the solution, but I looked their, tried what it shows, but still found now solution for my situation... When I follow what they say, I get the same error.有人说这个问题的答案是解决方案,但我查看了他们的答案,尝试了它显示的内容,但现在仍然找到了适合我情况的解决方案......当我按照他们所说的进行操作时,我得到了同样的错误。
Someone please help!!!有人请帮忙!!!
I created instruction:我创建了指令:
Install JDK (for example Oracle JDK 14 )安装 JDK(例如Oracle JDK 14 )
Open project folder with build.gradle
and settings.gradle
in Idea在 Idea 中使用
build.gradle
和settings.gradle
打开项目文件夹
Add JDK to project: press F4
on left Project Tool
-> SDk
-> Add
-> Apply
将JDK添加到项目中:在左侧
Project Tool
上按F4
-> SDk
-> Add
-> Apply
Set new SDK to project: press F4
on left Project Tool
-> Project
-> Project SDK
-> Set new SDK
-> OK
设置新的
F4
到项目:在左侧Project Tool
-> Project
-> Project SDK
-> Set new SDK
-> OK
Set new SDK to Gradle Build Tool
: press Ctrl + Alt + S
-> Find gradle
in search -> Go to Gradle JVM
-> Set new SDK -> OK
Set new SDK to
Gradle Build Tool
: press Ctrl + Alt + S
-> Find gradle
in search -> Go to Gradle JVM
-> Set new SDK -> OK
Create new directory src/main/kotlin/main.kt
with code使用代码创建新目录
src/main/kotlin/main.kt
fun main() {
val jdk = System.getProperty("java.version")
println("Using JDK: $jdk")
}
main.kt
in Editor and press Ctrl + Shift + F10
and you must see your JDK version in console like: Using JDK: 14.0.2
main.kt
到编辑器中的 main.kt 并按Ctrl + Shift + F10
,您必须在控制台中看到您的 JDK 版本,例如: Using JDK: 14.0.2
Take a look sample project看样例项目
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.