问题
I am using Java SE with Eclipse happily but now I am going to write a "send mail" program which requires javax.mail
package. I found that in Java EE so I downloaded one (180MB) and I know that Java EE installation needs SE JDK/JRE. Because I installed Java SE in c:\java\jdk1.7
(not the default path) I use -j c:\java\jdk1.7
to install Java EE. I have several questions about it.
How could I let Eclipse to load the Java EE package? Should I change the JRE in Java EE? Now Eclipse still only know the SE lib.
Do we have a JDK version which include APIs from Java EE? Because I really do not want to install two JREs in my computer and I do not need Glassfish. Can some one tell me which one I should download?
Is there
src.zip
for Java EE api? I cannot find it.
回答1:
Getting Java mail
Download Java Mail API
from Oracle website.
Exctract the JARs (mailapi.jar
has the desired java.mail
package) and put in yout CLASSPATH by:
RightClick(project) -> properties -> Java Build Path -> Libraries
-> add Jars/Add External Jars (depends where you put your JARS)
Updating the JRE In your eclipse, use the menu options as below:
window -> preferences-> Java -> Installed JREs -> Add
Give the path as c:\java\jdk1.7
and follow the steps to complete.
Once done, JDK 1.7
will appear in the list with checkbox
in front. Select the checkbox
and press OK
.
You should be all set, if you haven't done any project specific settings.
To verify the project specific settings, follow the steps:
RightClick(project) -> properties -> Java Build Path -> Libraries.
Your JDK 1.7
should appear in right pane.
来源:https://stackoverflow.com/questions/12773152/confusion-about-java-se-and-java-ee