Which version of Java needed to compile Traccar?

wmfairuz9 months ago

Hi!

I'm trying to compile traccar on MacOS running Java 21 and Gradle 8.6.

java --version
openjdk 21.0.2 2024-01-16
OpenJDK Runtime Environment Homebrew (build 21.0.2)
OpenJDK 64-Bit Server VM Homebrew (build 21.0.2, mixed mode, sharing)

But getting this error;

./gradlew assemble
Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

* What went wrong:
Could not open settings generic class cache for settings file '/Users/fairuz/code/java/traccar/settings.gradle' (/Users/fairuz/.gradle/caches/7.5.1/scripts/6erddp68083wy54s7q7uzbueh).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 65

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s

I wonder is there any specific gradle version that I should use? Thanks

Anton Tananaev9 months ago

Version 11 or higher.

wmfairuz9 months ago

Thanks! But I'm getting error with version 21. Is there any maximum version that I should use?

Anton Tananaev9 months ago

No, but you can try earlier versions to see if it fixes the problem.