3
votes

I've created a gradle project with the following configuration:

group '...'
version '0.0'

apply plugin: 'java'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

test {
    useTestNG()

    beforeTest { descriptor ->
        logger.lifecycle("Running test: " + descriptor)
    }
}

When I execute "gradle build" I have the following error message:

Cannot find System Java Compiler. Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable to point to the according directory.

This is weird since I have $JAVA_HOME set:

✗ echo $JAVA_HOME
/usr/lib/jvm/java-8-oracle
✗ $JAVA_HOME/bin/javac
Usage: javac <options> <source files>
where possible options include:
1
Are you using any IDE? - Bruno Caceiro
Yes, but I am building it from a terminal - Ivan Mushketyk
If this may help, I am using IDEA - Ivan Mushketyk
Check if you have the JDK correctly configured in your IDE. - Bruno Caceiro
How JDK setup in IDE can interfere with a console tool? - Ivan Mushketyk

1 Answers

-4
votes

I've found a solution.

To fix this issue I simply executed:

./gradlew build

This did the trick.