How to set JRE for ANT right in console parameter, not in Eclipse

自古美人都是妖i 提交于 2019-12-12 02:48:44

问题


My question is the same, but I do not know how to set another JRE right in ant! I need to run scripts in console like "path-to-buil-xml/ant"

I do that in Eclipse and I select JRE that I need, but how to set it in console ant?
What the name of parameter?

eclipse: change jre that is used to run ant

I need to build my project in the conditions when I do not have Eclipse.

  1. Now I can compile project with Eclipse when I change JRE from C:\Program Files\Java\jdk1.6.0_27 to another JRE 1.4.
  2. I can do the same without Eclipse but with changing JAVA_HOME to JRE 1.4. But on destination machine I can not change JAVA_HOME, because access denied!

How to do that?


回答1:


In the console ant refers to the environment variable JAVA_HOME to find the JRE.

If you don't want to edit the system settings for the windows cmd console use (this will reset when you close the console)

SET JAVA_HOME=PATH_TO_JAVA_HOME

You can also set the jdk(via the javac coomand) an argument to the javac task:

  <javac srcdir="${src}"
         destdir="${build}"
         fork="yes"
         executable="/opt/java/jdk1.1/bin/javac"
  />

Side note:

It really needs to be a jdk, if you need to compile.



来源:https://stackoverflow.com/questions/9819109/how-to-set-jre-for-ant-right-in-console-parameter-not-in-eclipse

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