简体   繁体   English

NetBeans IDE 6.7.1 Ant脚本变量

[英]NetBeans IDE 6.7.1 Ant Script variables

How do I get the location of rt.jar in my Ant script with NetBeans without editing my project.properties? 如何在不编辑project.properties的情况下使用NetBeans在Ant脚本中获取rt.jar的位置? ${java.home} is returning the location of the jre folder and not the jdk folder. $ {java.home}返回jre文件夹而不是jdk文件夹的位置。

I know that I could easily add a value to project.properties but I don't want to. 我知道我可以轻松地向project.properties添加值,但是我不想这样做。 I also know that I could easily just modify the path whenever I switch computers but I would prefer not to do that either. 我也知道,每当切换计算机时,我都可以轻松地修改路径,但是我也不希望这样做。

Edit: Maybe ${java.home} is the best solution and I should just fix my computers environment variables correctly. 编辑:也许$ {java.home}是最好的解决方案,我应该正确地修复计算机环境变量。

Edit2: I just realized that java.home is not the same as JAVA_HOME. Edit2:我刚刚意识到java.home与JAVA_HOME不同。 More information: http://javahowto.blogspot.com/2006/05/javahome-vs-javahome.html 详细信息: http : //javahowto.blogspot.com/2006/05/javahome-vs-javahome.html

Do you have JAVA_HOME set? JAVA_HOME吗? If so does it point on a JDK? 如果是这样,它是否指向JDK? From the Ant documentation : 从Ant 文档

When you need JDK functionality (such as for the javac task or the rmic task), then tools.jar must be added. 当您需要JDK功能(例如用于javac任务或rmic任务)时,必须添加tools.jar The scripts supplied with Ant, in the bin directory, will add the required JDK classes automatically, if the JAVA_HOME environment variable is set. 如果设置了JAVA_HOME环境变量,则bin目录中与Ant一起提供的脚本将自动添加所需的JDK类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM