我如何在Eclipse .classpath文件使用环境变量? [英] How do I use environment variables in an Eclipse .classpath file?

查看:187
本文介绍了我如何在Eclipse .classpath文件使用环境变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows我有一个环境变量EXTERNAL_LIB_ROOT指向C:\\ Program Files文件\\ MyExternalLibRoot。在另一台机器,它可能是C:\\ ExternalLibs

In Windows I have an environment variable EXTERNAL_LIB_ROOT that points to C:\Program Files\MyExternalLibRoot. On another machine, it may point to C:\ExternalLibs.

在一个Ant build.xml文件,我会用:

In an ant build.xml file I would use:

<pathelement location="${env.EXTERNAL_LIB_ROOT}/path/to/jar.jar"/>

我如何建立一个Eclipse项目.classpath文件使用EXTERNAL_LIB_ROOT环境变量?是否有可能使Eclipse自动使用上述环境变量生成build.xml文件?

How do I set up an Eclipse project .classpath file to use the EXTERNAL_LIB_ROOT environment variable? Is it possible to have Eclipse auto generate the build.xml file using the environment variable as above?

推荐答案

不是一个环境变量,但你可以设置<一个href=\"http://help.eclipse.org/indigo/index.jsp?topic=/org.eclipse.platform.doc.user/concepts/cpathvars.htm\"相对=nofollow>在Eclipse路径变量。路径变量是每个工作区。因此,它们是共享工作空间内的多个项目之间的共同位置的方便的方法。我已经使用它们共享项目中一个lib文件夹。

Not an environment variable, but you can set up a Path Variable in Eclipse. Path variables are per-workspace. They are therefore a convenient way of sharing a common location among multiple projects within a workspace. I have used them to share a lib folder among projects.

要创建一个路径变量(无论是第一次,或重复使用在项目现有):

To create a Path Variable (either for the first time, or to re-use an existing one in a project):


  • 文件/新建/文件夹

    • 打开新建文件夹对话框


    • 打开选择路径变量对话框

    在你的情况下,创建一个名为EXTERNAL_LIB_ROOT变量。

    In your case, create a variable called EXTERNAL_LIB_ROOT.

    (顺便说一句,而不是从你的.classpath产生一个build.xml,我会建议,而不是创建您的build.xml的.classpath和.project)。

    (BTW, rather than generating a build.xml from your .classpath, I would suggest instead creating .classpath and .project from your build.xml.)

    这篇关于我如何在Eclipse .classpath文件使用环境变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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