I am reading a book "Introducing Spring Framework" and trying to run the first basic Hello World example.
Here Gradle is used to build project but somehow it fails to compile:
Caused by: java.lang.RuntimeException: 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.
The problem is, that I have properly configured JAVA_HOME
, and java -version
properly returns the version of jdk.
What might be wrong?
Edit: I am using Linux. Ubuntu.
Edit 2: Both which javac
and which java
display /usr/bin/java
Edit 3: Now the compiler seems to be working, but it doesn't understand spring annotation used in code. I do have spring reference in gradle.build
:
apply plugin: 'java'
apply plugin: 'application'
mainClassName = System.getProperty("mainClass")
repositories {
mavenCentral()
}
dependencies {
compile 'org.springframework:spring-context:4.0.5.RELEASE'
}