Unresolved Reference: System


I am using gradle to create a small application in IntelliJ I am getting the following error in the code inspection and when I try to run the main function:

Error:(4, 18) Kotlin: Unresolved reference: System

If I build with “gradle build” from the command line the build is successful and the resulting command runs.

here is the code:

fun main(args: Array<String>) {
    val cfgDir = System.getProperty("home.dir")

And this is the Gradle file:

    plugins {
    id 'org.jetbrains.kotlin.jvm' version '1.3.0'

group 'test'
version '1.0'

repositories {

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"

compileKotlin {
    kotlinOptions.jvmTarget = "1.8"
compileTestKotlin {
    kotlinOptions.jvmTarget = "1.8"


Have you configured the JDK in IDEA correctly?


No looks like somehow the .jar files from the JRE were missing. Only the .jars from the JDK were listed in the JDK setup. When I added the missing jar files it started working again.