• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Using JEE in Eclipse

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to use JavaMail which is a part of Java EE. I know that I can use standalone JavaMail librabry but it is not my purpose. I want to start using Java EE, and first use JavaMail classes.
I download and installed Java EE 6 SDK from
http://java.sun.com/javaee/downloads/index.jsp
Is it enough?

My question is, how can I use Java EE (for example use JavaMail classes) in Eclipse Classic WTP?
import.javax.mail.*; doesn't work. What should I do to import JavaMail from JEE platform?
 
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I haven't yet used JavaMail, so someone please correct me if I'm wrong, but I believe JavaMail will be a service provided by the JEE container (application server). On which application server will you be deploying your application? Once you decide that, you then set the Targeted Runtime for your project in Eclipse to that application server and Eclipse will then include all the application server-provided Jars on the build path.
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're depending on an IDE for stuff like this, you're leaning on crutches.

I haven't been paying attention to the full-stack JEE implementations, but Tomcat doesn't include javamail in the container, so for Tomcat, at least, you have to include 2 jars in your WAR: javamail.jar and activation.jar.
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:If you're depending on an IDE for stuff like this, you're leaning on crutches.

I haven't been paying attention to the full-stack JEE implementations, but Tomcat doesn't include javamail in the container, so for Tomcat, at least, you have to include 2 jars in your WAR: javamail.jar and activation.jar.



What? The OP said that he was trying to use JavaMail from within Eclipse. My response was about using JavaMail from within Eclipse (or that was my attempt, anyway).

I don't know much about Tomcat, but it was my understanding that JEE containers (like JBoss) provide JavaMail.

Incidentally, the purpose of the IDE is to make the development process easier. I've had a long career using both IDEs and not using them. They each have their merits.
 
Tim Holloway
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We're have a strict "no-flame" policy on the JavaRanch, but after a few hundred "I'm using Brand X IDE how do I...: questions, I'll admit sometimes my patience gets a little strained. We are, after all, attempting to help people become more skillful on their own, and not just by leaning on specific products. Which is why if you should scan the IDE forum for the question "Which IDE should I use?", a very frequent response is "Windows Notepad".

Eclipse is not a JEE container. Unless suitable plugins are added, it has no JEE capabilities or knowledge at all. Eclipse is also not intended to serve as a JEE application server, since there's nothing it can add that the regular JEE appservers don't already supply. You use Eclipse to design, edit, maintain and debug JEE code. Therefore the concept of "using JEE in Eclipse" is technically incorrect unless you intend to write a JEE plugin that wants to send and receive email, such as perhaps an integrated email client.

It's fairly obvious that this wasn't what was intended here, however, and what was intended was the development of a JEE application using javamail. Which is perfectly possible without using Eclipse. And, as far as I know, Eclipse doesn't have any plugins for that purpose anyway, since it's not something that requires a whole slew of wizards, documentation aids, debugging tools, code generators and other appurtenances that make an IDE so useful.

If I seem sensitive on this subject it's because I've seen too many cut-rate programmers being employed to develop products that they don't understand using tools that - as far as they're concerned - operate by magic. There's just too much bad software out there already to make me happy with that.
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:We're have a strict "no-flame" policy on the JavaRanch, but after a few hundred "I'm using Brand X IDE how do I...: questions, I'll admit sometimes my patience gets a little strained. We are, after all, attempting to help people become more skillful on their own, and not just by leaning on specific products. Which is why if you should scan the IDE forum for the question "Which IDE should I use?", a very frequent response is "Windows Notepad".



Are you saying that I flamed you, or made you want to flame me? It seems to me your post was an overreaction. The OP wasn't asking which IDE he should use. This is a forum for IDEs, is it not? Why shouldn't we answer questions which might help users use IDEs?

Tim Holloway wrote:Eclipse is not a JEE container. Unless suitable plugins are added, it has no JEE capabilities or knowledge at all. Eclipse is also not intended to serve as a JEE application server, since there's nothing it can add that the regular JEE appservers don't already supply. You use Eclipse to design, edit, maintain and debug JEE code. Therefore the concept of "using JEE in Eclipse" is technically incorrect unless you intend to write a JEE plugin that wants to send and receive email, such as perhaps an integrated email client.


Neither the OP nor my response made any hint at the idea that Eclipse was a JEE container or an application server. I must be honest, I just don't see where your comments are coming from. I assumed from the OP's post that he was trying to develop an application which would be deployed to a JEE-capable application server.

Tim Holloway wrote:It's fairly obvious that this wasn't what was intended here, however, and what was intended was the development of a JEE application using javamail. Which is perfectly possible without using Eclipse. And, as far as I know, Eclipse doesn't have any plugins for that purpose anyway, since it's not something that requires a whole slew of wizards, documentation aids, debugging tools, code generators and other appurtenances that make an IDE so useful.



Again, I don't think the OP was asking whether or not he should be using Eclipse (or any IDE for that matter).

Tim Holloway wrote:If I seem sensitive on this subject it's because I've seen too many cut-rate programmers being employed to develop products that they don't understand using tools that - as far as they're concerned - operate by magic. There's just too much bad software out there already to make me happy with that.



Most of my development work (over the last 25+ years) has been outside of a formal IDE. I actually prefer it for most tasks. However, I don't feel it's my place to impose my will on other developers. If they want to use an IDE for a particular task, that's their decision.
 
Tim Holloway
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kamil Kuchta wrote:
import.javax.mail.*; doesn't work. What should I do to import JavaMail from JEE platform?



You have to indicate that the javamail jar is part of your Eclipse build path using the Project Propteries/Java Build Path/Libraries tab . If your JEE container (JBoss, WebSphere or whatever) contains a javamail.jar file, that's normally the one you'd point to. The download you did is primarily useful for reference purposes but the actual container version is more authoritative for that particular container.

For Tomcat and for non-web-container JEE, like I said JavaMail isn't supplied with the container, so you'd have to download a copy if it's not in what you already downloaded:

http://java.sun.com/products/javamail/

There are certain build tools that will handle this for you automatically, such as Maven.
 
reply
    Bookmark Topic Watch Topic
  • New Topic