简体   繁体   中英

Can javac 11 compile binaries/jars that will run on a java 8 JVM?

Can javac 11 compile binaries/jars that will run on a java 8 JVM?

If so, with what flags?

Will setting gradle source compatibility to 11 and target compatibility to 8 work?

Yes, but not with source=11 and target=8; only source=8 target=8 will work. You can't use any java features introduced in java9, 10, or 11.

On the command line, the javac option you're looking for is -release 8 (which is like -source 8 -target 8 but shorter and better).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM