I successfully installed gradle
, and downloaded NeedForSpeed exercise for Java. I created my solution for this exercise inside two files, NeedForSpeed.java
and RaceTrack.java
, since solution requires 2 classes.
I’m using Java 20, and Gradle 8.3. JAVA_HOME
environment variable is configured, and both java and gradle are included in the PATH
variable as well.
I’m using IntelliJ IDEA, and inside Settings → Build, Execution, Deployment → Build Tools → Gradle, I’ve set my Gradle distribution to local installation, with path being “C:/Program Files/Gradle/gradle-8.3” where I have it installed. Gradle JVM is set to JAVA_HOME
, i.e. my Java 20 JDK installation.
When I do gradle test
, I get this error
Task :compileTestJava FAILED
C:\Users\MyUserName\Exercism\java\need-for-speed\src\test\java\NeedForSpeedTest.java:122: error: cannot find symbol
var race = new RaceTrack(distance);
^
symbol: class RaceTrack
location: class NeedForSpeedTest
C:\Users\MyUserName\Exercism\java\need-for-speed\src\test\java\NeedForSpeedTest.java:134: error: cannot find symbol
var race = new RaceTrack(distance);
^
symbol: class RaceTrack
location: class NeedForSpeedTest
C:\Users\MyUserName\Exercism\java\need-for-speed\src\test\java\NeedForSpeedTest.java:146: error: cannot find symbol
var race = new RaceTrack(distance);
^
symbol: class RaceTrack
location: class NeedForSpeedTest
C:\Users\MyUserName\Exercism\java\need-for-speed\src\test\java\NeedForSpeedTest.java:158: error: cannot find symbol
var race = new RaceTrack(distance);
^
symbol: class RaceTrack
location: class NeedForSpeedTest
4 errorsFAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ‘:compileTestJava’.
Compilation failed; see the compiler error output for details.Try:
Run with --info option to get more log output.
Run with --scan to get full insights.BUILD FAILED in 872ms
2 actionable tasks: 1 executed, 1 up-to-date
PS C:\Users\MyUserName\Exercism\java\need-for-speed>