English 中文(简体)
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.





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签