java tm 安装后仍无效_Ant构建失败,“[javac] javac:无效目标版本:7”

感谢大家的帮助!

我在尝试使用Ant编译项目时遇到错误,它声称“[javac] javac:无效的目标版本:7”并导致构建失败 .

我在Mac OSX Mavericks机器上运行javac版本1.7.0_40 . Ant版本:Apache Ant(TM)版本1.8.3于2012年2月26日编译

只有在尝试使用Ant进行编译时才会出现问题 . 使用命令行中的javac编译项目中的单个文件(使用以下命令):

javac -d /Users/username/git/appinventor-sources/appinventor/common/build/classes/CommonUtils -classpath /Users/username/git/appinventor-sources/appinventor/common/build/classes/CommonUtils:/Users/username/git/appinventor-sources/appinventor/lib/guava/guava-14.0.1.jar -target 7 -encoding utf-8 -g:lines,vars,source -source 7 common/src/com/google/appinventor/common/utils/*

build-common.xml文件为javac指定:

阅读this后,我在我的机器上检查了早期的Java版本,但没有找到任何版本 .

executable="/usr/bin/javac"

到build-common.xml文件以确保它找到了正确的Java编译器,但错误仍在继续 .

命令行输出如下:

init:

CommonUtils:

[javac] Compiling 1 source file to /Users/username/git/appinventor-sources/appinventor/common/build/classes/CommonUtils

[javac] javac: invalid target release: 7

[javac] Usage: javac

[javac] use -help for a list of possible options

BUILD FAILED

/Users/username/git/appinventor-sources/appinventor/build.xml:16: The following error occurred while executing this line:

/Users/username/git/appinventor-sources/appinventor/build-common.xml:318: The following error occurred while executing this line:

/Users/username/git/appinventor-sources/appinventor/common/build.xml:42: The following error occurred while executing this line:

/Users/username/git/appinventor-sources/appinventor/build-common.xml:120: Compile failed; see the compiler error output for details.

以详细方式运行ant产生了以下细节:

[javac] Compiling 1 source file to /Users/username/git/appinventor-sources/appinventor/common/build/classes/CommonUtils

[javac] Using modern compiler

[javac] Compilation arguments:

[javac] '-d'

[javac] '/Users/username/git/appinventor-sources/appinventor/common/build/classes/CommonUtils'

[javac] '-classpath'

[javac] '/Users/username/git/appinventor-sources/appinventor/common/build/classes/CommonUtils:/Users/username/git/appinventor-sources/appinventor/lib/guava/guava-14.0.1.jar'

[javac] '-target'

[javac] '7'

[javac] '-encoding'

[javac] 'utf-8'

[javac] '-g:lines,vars,source'

[javac] '-verbose'

[javac] '-source'

[javac] '7'

[javac]

[javac] The ' characters around the executable and arguments are

[javac] not part of the command.

[javac] File to be compiled:

[javac] /Users/username/git/appinventor-sources/appinventor/common/src/com/google/appinventor/common/utils/package-info.java

[javac] javac: invalid target release: 7

[javac] Usage: javac

[javac] use -help for a list of possible options

[ant] Exiting /Users/username/git/appinventor-sources/appinventor/common/build.xml.

有任何想法吗?非常感谢帮助 .

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值