开发者

Javax.mail in JNLP

开发者 https://www.devze.com 2022-12-11 22:44 出处:网络
I have a problem with my program. I develop in Netbeans, and when i run the program it is working fine. i built it, created a *.jar file, and updatet it in my JNLP file.

I have a problem with my program. I develop in Netbeans, and when i run the program it is working fine. i built it, created a *.jar file, and updatet it in my JNLP file.

here comes the trouble. as i'm using javax.mail.* in my program, the jnlp package just ignores all parts of it.

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.

Thanks for any help.


Incorporate a javamail implementation. The Apache Geronimo implementation is convenient from an licensing standpoint. 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.


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:

<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.


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:

<security>
    <all-permissions/>
</security>

If you use the Java EE mail implementation, then you need to include two jar files in your library:

<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).

You also asked "can u offer me a way to run this program on my computer without netbeans and command prompt?"

That is pretty much the whole point of jnlp. You can launch the program from a web browser. The java tutorial contains many examples of this: For example: JButton example

If this is the way you wish to deploy your application, you can read the Web Start developers guide.

0

精彩评论

暂无评论...
验证码 换一张
取 消