[英]Javax.mail in JNLP
I have a problem with my program. 我的程序有问题。 I develop in Netbeans, and when i run the program it is working fine. 我使用Netbeans开发,运行程序时运行良好。 i built it, created a *.jar file, and updatet it in my JNLP file. 我建立了它,创建了一个* .jar文件,并在我的JNLP文件中对其进行了更新。
here comes the trouble. 麻烦来了。 as i'm using javax.mail.* in my program, the jnlp package just ignores all parts of it. 当我在程序中使用javax.mail。*时,jnlp包只会忽略它的所有部分。
Just to be clear, i'm working on a mail client. 为了清楚起见,我正在使用邮件客户端。 now i can check the numbers of the mails in the inbox. 现在,我可以检查收件箱中邮件的数量。 that is what the program ignores in JNLP. 这就是程序在JNLP中忽略的内容。
Thanks for any help. 谢谢你的帮助。
Incorporate a javamail implementation. 合并一个javamail实现。 The Apache Geronimo implementation is convenient from an licensing standpoint. 从许可的角度来看,Apache Geronimo实现很方便。 That is, get a JAR file containing an implementation of javax.mail (other than the one built into j2ee) and package that into your JNLP package. 也就是说,获取一个包含javax.mail实现的jar文件(j2ee内置的实现除外),并将其打包到您的JNLP包中。
I think all you need to do is to sign java mail implementation (either native or some 3rd party) JAR
's, add them to your JNLP
file: 我认为您所需要做的就是对Java邮件实现(本机或某些第三方) JAR
进行签名,并将其添加到您的JNLP
文件中:
<resources>
<jar href="mail-jar1"/>
<jar href="mail-jar2"/>
<!-- more -->
</resources>
...and then drop them along with your main JAR
to your web server of choice. ...然后将它们与您的主JAR
一起拖放到您选择的Web服务器上。
In order for your program to have access to the network and communicate with a mail server, you need to sign all of the jars and include in the jnlp file this code: 为了使您的程序能够访问网络并与邮件服务器通信,您需要对所有jar签名并在jnlp文件中包含以下代码:
<security>
<all-permissions/>
</security>
If you use the Java EE mail implementation, then you need to include two jar files in your library: 如果使用Java EE邮件实现,则需要在库中包括两个jar文件:
<resources>
<jar href="lib/activation.jar"/>
<jar href="lib/mail.jar"/>
</resources>
I like to place all of the library jar files in a separate folder, which is what netbeans normally does for you when it builds you app (look in the dist folder). 我喜欢将所有库jar文件放在一个单独的文件夹中,这是netbeans在构建应用程序时通常会为您执行的操作(在dist文件夹中查找)。
You also asked "can u offer me a way to run this program on my computer without netbeans and command prompt?" 您还问“您能否提供一种无需Netbeans和命令提示符即可在我的计算机上运行此程序的方法?”
That is pretty much the whole point of jnlp. 这几乎就是jnlp的全部重点。 You can launch the program from a web browser. 您可以从网络浏览器启动程序。 The java tutorial contains many examples of this: For example: JButton example Java教程包含许多这样的示例:例如: JButton示例
If this is the way you wish to deploy your application, you can read the Web Start developers guide . 如果这是您希望部署应用程序的方式,则可以阅读《 Web Start开发人员指南》 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.