0

I have looked through several tutorials (and my Java manuals) and I am totally confused as to whether it is better to set the classpath variable for mail.jar (JavaMail api) or just place the mail.jar file in my EXT directory in jdk1.7.0. Setting it directly in the EXT makes sense to me because compilation would seem easier.

This is where most tutorials (using that approach) said it belongs --- C:\Program Files\Java\jdk1.7.0_07\jre\lib\ext

One even states "Note that in Windows, to be safe, you should install it in both the JRE and JDK lib/ext directories."

Would I copy mail.jar into the ext directory and the jar files in the lib directory (the lib directory in javamail1-4-7) or where would I put the 6 jar files in that directory relating to my jdk1.7.0_07 directory structure (dsn.jar, gimap.jar, imap.jar, mailapi.jar, pop3.jar, and smtp.jar)?

And with jdk1.7.0_07 do I still need to add the JavaBeans Activation Framework additionally? (I am under the impression that I would not have to)

I have found these two posts on your site:

Restriction error on JavaMail library

Access restriction: The constructor Provider() is not accessible due to restriction on required library jdk1.6.0\jre\lib\jsse.jar?

but neither really cleared this question up for me

Thanks in advance for any thoughts, advice, and help.....

Community
  • 1
  • 1
vbaNovice
  • 1
  • 2

1 Answers1

0

You should add any dependencies required by your application within the application JAR itself. It is good practice to ship dependencies required by the application. This will enable the Java code to compile and run.

Name Name
  • 175
  • 1
  • 2
  • 11
  • If I understand things, when I compile my application JAR as long as it includes an import statement for each javax.mail.xxx class I need, right? What I am wondering is why I couldn't have the Mail.jar in my ext directory in Java1.7.0_07. The reason I am wondering is because I develop most code on desktop in home office, but will often travel to client's houses to update (recompile) application. I use a laptop for visits and it would just be easier if I had Mail.jar in same location on both machines. Thanks for assistance. – vbaNovice Dec 01 '14 at 14:26
  • I think I finally found what I was looking for in another article from this site.... http://stackoverflow.com/questions/10953031/where-to-put-jar-files-to-avoid-conflicts?rq=1 Now I have to put in some study time understanding this knowledge. Thanks again for your help – vbaNovice Dec 01 '14 at 20:50