[英]LocalDateTime in IntelliJ IDEA Kotlin shows as unresolved reference
java.time seems to be missing entirely. java.time似乎完全没有了。 The code I'm trying it in is a simple
我正在尝试的代码很简单
fun main(args: Array<String>) {
println(LocalDateTime.now())
}
Seems like I am missing something fundamental, but all I have been doing is following along in a tutorial and it just worked for the tutor. 好像我缺少一些基本的东西,但我一直在做的是在教程中跟随它,它只是为导师工作。
The LocalDateTime
class has only been introduced in Java SE 8, so you need to compile your project against JDK 8 or newer. LocalDateTime
类仅在Java SE 8中引入,因此您需要针对JDK 8或更高版本编译项目。
Make sure that: 确保:
You have an installed JDK 8 or newer; 您已安装JDK 8或更新版本;
Your project is compiled against this JDK 8+. 您的项目是针对此JDK 8+编译的。
(In IntelliJ IDEA, Ctrl / ⌘ + Shift + Alt + S → Project → Project SDK ; other build systems should be set up separately) (在IntelliJ IDEA中, 按Ctrl / ⌘ + Shift + Alt + S → 项目 → Project SDK ;其他构建系统应单独设置)
With the JDK configured correctly, the code should run fine as-is: (demo) 正确配置JDK后,代码应该按原样运行:( 演示)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.