Example: Looking up a JavaMail session with JNDI
The example below shows a lookup of a JavaMail resource. The actual lookup name is determined by the application's deployment descriptors.
// Get the initial context as shown above ... Session session = (Session) initialContext.lookup("java:comp/env/mail/MailSession");
Related Tasks
Developing applications that use JNDI