Does STS support java 8?

77 Views Asked by At

I wonder if STS support Java 8 project. Because when I download the demo project, it says Java 17 and 21.

I am trying to use JDK 8 but getting compiling errors. It says fatal error compiling invalid flag: release.

No goals have been specified for this build.

1

There are 1 best solutions below

0
Martin Lippert On

Spring Tools 4 for Eclipse supports working on projects that compile against and run on Java 8. The preferences allow you to define appropriate JREs for Java 8 as well as setting the compiler target level to Java 8. In case you use something like Maven or Gradle, this compiler target level is usually automatically configured for you based on what you defined in the build spec of the project (e.g. the pom.xml file).

Spring and Spring Boot itself requires certain levels of Java as well. Spring Boot 3 for example has a baseline of Java 17, so you can't compile or run a Spring Boot 3 project on Java 8. You have to use Java 17 as a minimum.

Side note: All this is completely independent of the JDK that is used to run the IDE itself, which is usually the embedded OpenJDK 17 that we ship as part of the Spring Tools 4 for Eclipse distribution. The IDE is still able to compile for a Java 8 target and run projects using a JDK 8.

If you continue to run into problems, I would recommend to provide more details about your projects, build files, JDKs to run the project, sample projects, etc.