具有环境变量的外部JAR

具有环境变量的外部JAR

本文介绍了Eclipse 3.4-具有环境变量的外部JAR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发Lotus Notes插件(Eclipse 3.4),并且需要依赖外部SDK/Connector来获取某些Java依赖关系以及配置文件.

I am developing a Plug-in for Lotus Notes (which is Eclipse 3.4) and need to rely on an external SDK/Connector for some Java dependencies and also Configuration files.

为了正常运行,似乎连接器安装文件夹中的文件必须位于类路径中.由于我不知道它的安装位置,因此我不得不依赖安装期间设置的环境变量("IBMCMROOT"),该环境变量包含文件夹.

It seems that in order to function properly, a file from the Connector installation folder has to be in the classpath. Since I don't know where it's installed, I have to rely on an environment variable that is set during installation ("IBMCMROOT"), which contains the folder.

有什么方法可以将Windows环境变量用于Eclipse插件的类路径定义吗?我尝试在清单中使用变量:

Is there any way to use Windows environment variables for the classpath definition of eclipse plug-ins? I've tried using variables in the manifest:

Bundle-ClassPath: external:$IBMCMROOT$/lib/cmb81.jar,
 $IBMCMROOT$/lib/cmbsdk81.jar,
 $IBMCMROOT$/lib/db2jcc.jar,
 .,
 $IBMCMROOT$/lib/guava-15.0.jar,
 $IBMCMROOT$/lib/log4j-1.2.17.jar

这会导致ClassNotFoundExceptions ...

This results in ClassNotFoundExceptions...

推荐答案

external:是Eclipse容器主义.但是我认为您需要为每个外部jar加上external:前缀.另外,IBMCMROOT必须是系统属性(不是环境变量).例如,使用-DIBMCMROOT=...

external: is an Eclipse containerism. But I think you need to prefix each external jar with external:. Also, IBMCMROOT must be a system property (not an environment variable). For example, start java with -DIBMCMROOT=...

但是,我不会这样做.而是将这些必需的jar放在类路径上,并配置系统捆绑包以导出那些包,然后可以从捆绑包中导入这些包.

However, I would not do this. Instead, put these necessary jars on the classpath and configure the system bundle to export those package which you can then import from your bundles.

这篇关于Eclipse 3.4-具有环境变量的外部JAR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 08:15