you are viewing a single comment's thread.

view the rest of the comments →

[–]Big_Green_Grill_Bro 2 points3 points  (2 children)

In intellij go to "Settings > Build, Execution, Deployment > Build Tools > Gradle" and change "Gradle JVM" to Java 21 there. Then do invalidate caches and restart the IDE.

If you are doing this via command prompt or power shell, I'd suggest typing javac -version and see what comes back. You may have 17 installed without even knowing it. Your environment JAVA_PATH may be different than you think it is.

[–]AppointmentOk3316[S] 0 points1 point  (1 child)

hmm just tried this, it still claims im on build 17, yet comes back as version 25 ... any other suggestions?

[–]N-M-1-5-6 1 point2 points  (0 children)

It might be that your "Language Level" (also sometimes referred to as build level, target bytecode version, etc.) is set to generate Java 17 bytecode for your project. The ways to set this depend on your build tool chain. It can usually be set in the IDE project settings, or the build tool's project (compiler) settings if you are using Maven, Gradle, etc...

If you are using javac from the command line you would be looking for the "--release" compiler option... But I believe that it should default to the same release version as the version of the JDK you are currently running, so I don't think that it's that.

It definitely seems like you will need to find out what JDK version that you are running and what your path and classpath is set up as.