SonarQube 8.9 does not support Java 17: neither for running the server / scanner nor for analysis of Java 17 code in projects.
In SonarQube 9.4, Java 17 is supported for running analysis, and parsing of Java 18 code (and 17, too) is also supported.
Regarding the version of Java your code runs with, as long as you analyze with a supported version of Java, you can compile with or to whatever version of Java you like.
When upgrading Java from 8 to 17, we’ll need to be on at least SonarQube 9.4. But even with 9.7, it shows 0 coverage. Are there any changes required in Sonar configuration?