0

When trying to use the Session class from the javamail library I get an error:

Description Resource Path Location Type Access restriction: The type Session is not accessible due to restriction on required library C:\Program Files\Java\jre7\lib\ext\mail.jar Mailer.java /MailerApp/src line 21 Java Problem

Don't I have the library in the right place? I have the folder in the jdf1.7.0_01/jre/lib/ext directory.

Alexis Pigeon
  • 7,423
  • 11
  • 39
  • 44
  • probably it helps http://stackoverflow.com/questions/9052391/access-restriction-the-constructor-provider-is-not-accessible-due-to-restrict – Ramesh Kotha Aug 29 '12 at 15:13

1 Answers1

0

You shouldn't need to put the library in jre/lib/ext, just add it to your application's classpath in the normal way (you don't say what IDE or build system you're using so I can't help with what "the normal way" would be).

Ian Roberts
  • 120,891
  • 16
  • 170
  • 183
  • Thank you! I thought that I could put the library somewhere in the program files so that it would automatically be recognized but it works perfectly that way. – user1631937 Aug 30 '12 at 01:30
  • You should only really use `jre/lib/ext` for packages that are designed to go there and whose documentation tells you to install them there. If you're not sure whether a particular jar belongs in `ext` then it probably doesn't... – Ian Roberts Aug 30 '12 at 08:45