Target different version of JRE

懵懂的女人 提交于 2019-11-28 13:23:14

From the command line, change your call to:

javac -source 1.7 -target 1.7 HttpsTest.java SSLSocketFactoryEx.java

The documentation for javac (for JDK 8) is here.

The documentation for javac (for JDK 9) is here.

Note: In JDK 9, -target is replaced with --release.

If you are using eclipse you can set compiler compliance level in the project properties-> Java Compiler. So your code is compiled for the chosen Java version. See here:

Piyush Gharote

In the error message major.minor version 52. the number 52 here represents the java version with which the class is compiled for example

Java SE 9 = 53
Java SE 8 = 52
Java SE 7 = 51
Java SE 6.0 = 50
Java SE 5.0 = 49
JDK 1.4 = 48
JDK 1.3 = 47
JDK 1.2 = 46
JDK 1.1 = 45

so your installed JRE is at higher version than your target use -source with the version number to which you want to compile in your case:

javac -source 1.7 -target 1.7 HttpsTest.java SSLSocketFactoryEx.java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!