java ant:指定应使用哪个java安装来运行
是否可以指定系统上的哪个 java 安装用于运行 java任务? 如果是,怎么办?
就我而言,我想指定是否要运行 32 位版本或 64 位版本。
谢谢!
is it possible to specify which installation of java on the system should be used to run a
java task?
if yes, how?
in my case i want to specify if i want to run the 32bit or the 64bit version.
thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我相信这就是
< 的
Ant任务是关于。jvm
属性;java>jvm - 用于调用Java虚拟机的命令,默认为'java'。该命令由 java.lang.Runtime.exec() 解析。如果 fork 被禁用,则忽略。
I believe this is what
jvm
attribute of the<java>
Ant task is about.jvm - the command used to invoke the Java Virtual Machine, default is 'java'. The command is resolved by java.lang.Runtime.exec(). Ignored if fork is disabled.
来自 http://ant.apache.org/manual/Tasks/java.html
fork 是否在外部使用JDK编译器执行javac;默认为 no
可执行文件 在 fork="yes" 的情况下使用的 javac 可执行文件的完整路径。默认为当前运行 Ant 的 Java 版本的编译器。如果 fork="no" 则忽略。
从 Ant 1.6 开始,当使用 jikes、jvc、gcj 或 sj 时,此属性还可用于指定可执行文件的路径。
From http://ant.apache.org/manual/Tasks/java.html
fork Whether to execute javac using the JDK compiler externally; defaults to no
executable Complete path to the javac executable to use in case of fork="yes". Defaults to the compiler of the Java version that is currently running Ant. Ignored if fork="no".
Since Ant 1.6 this attribute can also be used to specify the path to the executable when using jikes, jvc, gcj or sj.
使用
JAVACMD
环境变量(请参阅此处)Use the
JAVACMD
environment variable (see here)由于
命令不允许您指定 JVM,因此我建议您使用
直接执行您想要的确切java
二进制文件和命令行。Since the
<java>
command doesn't let you specify the JVM, I'd suggest you use<exec>
directly to execute the exactjava
binary and command line you want.