简体   繁体   中英

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM