java – warning:[options] bootstrap类路径未与-source 1.5一起设置


warning: [options] bootstrap class path not set in conjunction with
-source 1.5



To use javac from JDK N to cross-compiler to an older platform version, the correct practice is to:

  • Use the older -source setting.
  • Set the bootclasspath to compile against the rt.jar (or equivalent) for the older platform.

If the second step is not taken, javac will dutifully use the old language rules combined with new libraries, which can result in class files that do not work on the older platform since references to non-existent methods can get included.

转载请明显位置注明出处:java – warning:[options] bootstrap类路径未与-source 1.5一起设置