如何在Notes Xpages应用程序中添加外部第三方jar? [英] How to add external third party jar in Notes Xpages application?

查看:164
本文介绍了如何在Notes Xpages应用程序中添加外部第三方jar?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Java开发人员,最近从事Xpages项目。我们使用的是Notes 9.0.1。我创建了Java代理来发送电子邮件,我想使用一些第三方jar,比如org.apache.commons.lang3,结束了这个问题。如何在我的Xpages项目中添加第三方jar,比如commons-lang3-3.4.jar?

I am Java developer, recently working on Xpages project. we are using Notes 9.0.1. I created Java agent to send email and I want to use some third party jar, something like org.apache.commons.lang3 , end up this issue. how to add third party jar, like commons-lang3-3.4.jar, in my Xpages project?

我尝试了不同的方式


  1. 在/ jvm / lib / ext文件夹下添加jar,重新启动DDE。我可以在
    我的项目JRE系统libray中看到它,但无法在我的Java代码中导入。
    也许这是服务器部署的方式。

  2. 在/ Code / Jars下添加jar,然后在/ Webcontent / WEB-INF / lib中添加新名称生成DDE,但是...

  3. 直接在/ Webcontent / WEB-INF / lib下添加jar,但未在应用程序视图中显示/ Code / Jars

  4. 添加jar在Java代理存档文件夹下,但是......

  1. add jar under /jvm/lib/ext folder, restart DDE.the I can see it in my project JRE system libray, but could not import in my Java code. Maybe this is the way for server deployment.
  2. add jar under /Code/Jars and then DDE generated with new name added in /Webcontent/WEB-INF/lib, but...
  3. Add jar directly under /Webcontent/WEB-INF/lib, but not appeared /Code/Jars in Application view
  4. add jar under the Java agent Archive folder, but...

它们都不允许我在我的Java代码中导入包。

None of them allows me import the package in my Java code.

我做错了什么,或者有什么好办法在XPages项目中添加第三方jar。

Anything I did wrong, or is there any good way to add third party jar in XPages project.

谢谢

推荐答案

如果通过将JAR导入 / Code / JARs 将JAR添加到项目中,它应该是添加以便可以通过构建路径访问(2,3)。您的 / WebContent / WEB-INF / lib 也是如此,但可能不会在您的DDE版本中自动定义;例如,Domino Designer 9具有 / Code / Java / Code / JARs 的设计元素,这些元素以前不存在(这些是来自<的单独文件夹/路径em> / WebContent / WEB-INF / src 或 / WebContent / WEB-INF / lib ,都可以在构建路径中)。在任何一种情况下,如果您的方法是在NSF中使用JAR,请确保您的构建路径具有JAR的路径。另外,您可以单独添加每个JAR。

If you add a JAR to your project by importing it into /Code/JARs, it should be added so as to be accessible by your build path(2,3). The same is true of your /WebContent/WEB-INF/lib, but that may not be automatically defined in your version of DDE; for example, Domino Designer 9 has the design elements of /Code/Java and /Code/JARs, which didn't previously exist (these are separate folders/paths from /WebContent/WEB-INF/src or /WebContent/WEB-INF/lib, either can be in the build path). In either case, if your approach is to have the JAR in your NSF, make sure your build path has the path with your JARs. Separately you could add each JAR individually.

您可以通过项目>属性进入构建路径,然后对于有关JAR的构建路径部分,请转到库 :

You can get to the Build Path via Project > Properties, then for the part of your build path concerning JARs, go to "libraries":

项目构建路径中的各个JAR

individual JARs in Project Build Path

构建路径中的JAR类路径(ex- / WebContent / WEB-INF / lib)

JAR class path in Build Path (ex- /WebContent/WEB-INF/lib)

至于使用的路径/ jvm / lib / ext 文件夹方法,我已在博客文章中,记住将JAR放在服务器和Designer /本地路径中的相应路径上是很重要的(否则您的本地DDE可能不会拿起变化)。(1)

As for the path of using the /jvm/lib/ext folder approach, I've covered that in a blog post and it's important to remember to have the JARs in the appropriate relative path both on the server and in your Designer/local path (otherwise your local, DDE, may not pick up the change).(1)

对于两者,如果你保持自动关闭,你会蚂蚁,以确保您执行另一个构建以查看更改。

For both, if you keep build automatically turned off, you'll want to make sure you perform another build to see the changes.

对于Java Agent存档,这应该可以正常工作,我想知道你的构建自动设置是启用还是禁用。 / jvm / ext / lib 路径也应该适用于此(在我的链接博客文章中显示)。(4)*注意:正如Paul Withers在评论中指出的那样,将JAR导入Java代理可以引入内存泄漏问题,使 / jvm / ext / lib / 路径更好。

As for a Java Agent archive, this should just work and again I'm wondering whether your build automatically setting is enabled/disabled. The /jvm/ext/lib path ought to work for this as well (shown in my linked blog post).(4) *Note: as Paul Withers points out in the comments, importing a JAR to a Java Agent can introduce memory leak issues, making the /jvm/ext/lib/ path preferable.

这篇关于如何在Notes Xpages应用程序中添加外部第三方jar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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