如何通过eclipse中的相​​对路径导入外部库? [英] How to import external library by relative path in eclipse?

查看:109
本文介绍了如何通过eclipse中的相​​对路径导入外部库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用绝对路径导入了外部库。但是我有两个工作环境,在linux和windows之间切换。项目从SVN下载。所以我想知道是否可以通过相对路径导入这些库。



谢谢

解决方案

您应该声明一个变量(Java Build Path - > Add Variable ... - > Configure Variable ... - > New)来设置每个系统上的更改路径(例如FOO_BAR_HOME)。



您可以将变量添加到库中,并将其编辑为指向您的库,如

 %FOO_BAR_HOME%/ lib / foobar.jar 

现有的使用变量。



替代方案,您可以将库放在项目中(例如子文件夹'lib')。如果从这个位置添加库('添加Jars ...'NOT'添加外部Jars ...'),它将被相对路径添加。


I imported external libraries using absolute path. But I have two work environment and switching between linux and windows. projects are downloaded from SVN. So I was wondering whether I can import these libraries by relative path.

Thanks

解决方案

You should declare a variable (Java Build Path -> Add Variable... -> Configure Variable ... -> New) to set the changing path on each system (e.g. FOO_BAR_HOME).

Than you can add the Variable to the Libraries and edit it to point to your library, like

%FOO_BAR_HOME%/lib/foobar.jar

Take a look at the existing variables for usage.

Alternative you can place the library inside the project (e.g. subfolder 'lib'). If you add the library from this location ('Add Jars...' NOT 'Add External Jars...') it will be added by relative path.

这篇关于如何通过eclipse中的相​​对路径导入外部库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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