Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » unable to import javax.mail.* into java files in Eclipse
unable to import javax.mail.* into java files in Eclipse [message #192573] Wed, 07 February 2007 22:01 Go to next message
Eclipse UserFriend
Originally posted by: satsuv.msn.com

Hi,

I am using the latest version of Java (jdk1.6) and Eclipse. I also
downloaded JavaMail API and the jaf framework. I added both the mail.jar and
activation.jar to the CLASSPATH variable in Windows XP. I am able to run the
javamail sample programs from the command prompt. However, I get an error
message in Eclipse - import of any classes from the javamail api gives me an
error message. What could be the reason? Anyone else run into the same
problem?

Thanks,
Su
Re: unable to import javax.mail.* into java files in Eclipse [message #192581 is a reply to message #192573] Wed, 07 February 2007 22:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: wharley.bea.com

"Suvarna Damodaran" <satsuv@msn.com> wrote in message
news:eqdi8j$rp0$1@utils.eclipse.org...
> Hi,
>
> I am using the latest version of Java (jdk1.6) and Eclipse. I also
> downloaded JavaMail API and the jaf framework. I added both the mail.jar
> and activation.jar to the CLASSPATH variable in Windows XP. I am able to
> run the javamail sample programs from the command prompt. However, I get
> an error message in Eclipse - import of any classes from the javamail api
> gives me an error message. What could be the reason? Anyone else run into
> the same problem?

I think you might be confusing your compile classpath (that is, the "Java
Build Path") with the execution classpath.

But I'm not sure what you mean by "I get an error message in Eclipse -
import of any classes...". Can you be more specific? Do you mean that you
have a Java project within Eclipse, and you are trying to add an "import
javax.mail.*" line into a Java source file and getting a syntax error?

If that is the case, you probably need to add those .jar files into your
Java Build Path. Look in Project -> Properties -> Java Build Path.
Re: unable to import javax.mail.* into java files in Eclipse [message #192610 is a reply to message #192573] Wed, 07 February 2007 23:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse5.rizzoweb.com

Suvarna Damodaran wrote:
> Hi,
>
> I am using the latest version of Java (jdk1.6) and Eclipse. I also
> downloaded JavaMail API and the jaf framework. I added both the mail.jar and
> activation.jar to the CLASSPATH variable in Windows XP. I am able to run the
> javamail sample programs from the command prompt. However, I get an error
> message in Eclipse - import of any classes from the javamail api gives me an
> error message. What could be the reason? Anyone else run into the same
> problem?

Eclipse does not use the system variable CLASSPATH. Each Project in
Eclipse has its own build classpath. You'll need to import/copy the JARs
into your project and then add them to the project's build path.

This is all explained in detail in the Tutorials. Open the Eclipse Help
Contents and navigate to Java Development User Guide > Getting Started
and you'll see a couple of tutorials that teach you all the basics.

Hope this helps,
Eric
Re: unable to import javax.mail.* into java files in Eclipse [message #192626 is a reply to message #192573] Thu, 08 February 2007 03:33 Go to previous messageGo to next message
Charlie Kelly is currently offline Charlie KellyFriend
Messages: 276
Registered: July 2009
Senior Member
Hi Su,

One solution is to use the PDE wizard to create a plugin from existing
jar files (mail and jaf). Then make your project dependent on the new
plugin.

This technique works well for me.

Hope this helps.

Charlie


Suvarna Damodaran wrote:
> Hi,
>
> I am using the latest version of Java (jdk1.6) and Eclipse. I also
> downloaded JavaMail API and the jaf framework. I added both the mail.jar and
> activation.jar to the CLASSPATH variable in Windows XP. I am able to run the
> javamail sample programs from the command prompt. However, I get an error
> message in Eclipse - import of any classes from the javamail api gives me an
> error message. What could be the reason? Anyone else run into the same
> problem?
>
> Thanks,
> Su
>
>
Re: unable to import javax.mail.* into java files in Eclipse [message #192849 is a reply to message #192626] Thu, 08 February 2007 20:13 Go to previous message
Eclipse UserFriend
Originally posted by: eclipse5.rizzoweb.com

Charle Kelly wrote:
> Hi Su,
>
> One solution is to use the PDE wizard to create a plugin from existing
> jar files (mail and jaf). Then make your project dependent on the new
> plugin.
>
> This technique works well for me.

While it works, that is not the most direct or simplest way to go about
it. Most Eclipse users don't know anything about the PDE or creating
plugins.
Far simpler is to import the JARs into the project. If the same set of
JARs are needed by multiple projects, you can either create a User
Library and add that to each project's dependency, or create a small
Java Project that contains the JARs, add them to its build path, and
then make other projects depend on that one.

Hope this helps,
Eric
Previous Topic:Frame Focus
Next Topic:What is the hot key to copy the whole line in Eclipse?
Goto Forum:
  


Current Time: Thu Sep 19 20:57:22 GMT 2024

Powered by FUDForum. Page generated in 0.09578 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top