蚂蚁使用Java的版本低于系统的Java版本 [英] Ant using a lower version of Java than the system's Java version

查看:139
本文介绍了蚂蚁使用Java的版本低于系统的Java版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此行​​为出现了奇怪的我。下面是发生了什么:


  1. 我们有蚂蚁,该说 build.xml文件< javac的源=1.5目标=1.5>< / javac的方式>

  2. 我们已经把我们的系统(Linux)的上更新的Java 1.6,但我们忘了更新Ant build.xml文件。

  3. 蚂蚁建设成功发生,它是如何发生的?是像高版本的Java可以降级到较低的版本?或者,如果蚂蚁找不到的Java版本指定它使用默认的版本?


解决方案

将不会有任何问题,在这种情况下升级JDK

 < javac的源=1.5目标=1.5>< / javac的>

意味着它会告诉来源是用Java编写的1.5 Java编译器,它应该创造适合的Java SE 1.5 environment.This目标版本是真的有可能与新的JDK.This是完全一样的。

 的javac -source 1.5 -target 1.5

请参照的javac 工具

希望这有助于

This behaviour appeared strange me. The following is what happened:

  1. We have a build.xml file for Ant, which says <javac source="1.5" target="1.5"></javac>.
  2. We have updated Java on our system (Linux) to 1.6, but we forgot to update the Ant build.xml file.
  3. Ant building is happening successfully, How is it happening? Is it like the higher version of Java can downgrade to lower versions? Or if Ant cannot find the version of Java specified it uses the default version?

解决方案

There will not be any problem in upgrading JDK in this scenario

<javac source="1.5" target="1.5"></javac>

Means that it tells Java compiler that source is written using Java 1.5 and it should create the target build suitable for Java SE 1.5 environment.This is really possible with newer JDK.This is exactly the same as

javac -source 1.5 -target 1.5

Please refer the documentation of the javac tool

Hope this helps

这篇关于蚂蚁使用Java的版本低于系统的Java版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆