This error occurs when there is a mismatch between the version of Java that Flyway was compiled with and the one locally available in the Java runtime environment (JRE).
This issue is most likely to occur in one of two scenarios:
Flyway Commandline
As the Flyway CLI packages and ships the JRE, the only situation where this issue should occur is if you have a local Java environment that is superseding the one we supply.
This is most commonly achieved by setting the JAVA_HOME environment variable on the host system.
If you need multiple Java versions to cohabit, you can bypass this conflict by programmatically setting the variable dynamically in the terminal session of the Flyway instance so that its scope is constrained to that session rather than encompassing the host system.
Flyway Maven / Gradle / API projects
In this context the project creator will be defining the Java environment, so this is simply a case of ensuring parity between Flyway and your environment, in conjunction with any other dependencies you may have, E.G. Springboot.
Related to: