Java – many versions of JDK: how to specify which one to use?

I installed many versions of JDK: 1.4 2, 1.5 and 1.6

Solution

Two solutions

>Specify the full path in the command: for example / opt / Java / jdk16 / bin / javac... On Linux > use the - source and - target parameters of the javac command This allows you to specify the source code level and the target JRE version

Please also note:

>Some Linux distributions can include tools to specify which JDK version to use by default. > Use - source and - target to check whether your language structure is compatible with the target runtime, but not the core class This means that even if you use the string Isempty(), and compiling with - source 1.4 on JDK 1.6 will also be OK This may cause errors at run time

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>