JDK Compliance - False Security?

I have Java 7 installed, but I am setting the JDK to my Java 6 projects. Unfortunately, it turned out that this is not the same as compiling with Java 6.

For example, the javax.imageio.stream.ImageInputStream extends interface Closablein Java 7, which is not in Java 6. Using ImageInputStream, where it is expected Closable, compiles to my settings (Java 7, corresponding to Java 6), but gives a compilation error when using Java 6, Should this be so?

+5
source share
3 answers

To compile Java code for an older JRE, you need to do two things:

  • . , dystroy, , -, JVM.
  • Java. , Java (java.lang. *, Java.net. * ..), JRE.

, , , .

, .

  • Eclipse Java : " // Java", " JRE" , " "...".
  • javac -bootclasspath. : javac -target 1.5 -bootclasspath jdk1.5.0/lib/rt.jar OldCode.java ( javac manpage, " -" ).
+10

, JDK, - .

. JDK , , .

JDK, . JDK 6 javax.imageio.stream.ImageInputStream Java 7.

+6

bootclasspath . , JDK 7 , , -.

+3

All Articles