Moving to Java 6 EE from Java 6 SE
I have Java 6 SE, Tomcat 6, Eclipse Helios for J2EE, Chrome Browser Dev for JS up and working. Sometimes I need the source and doc for java libraries I believe are in the EE kit. What is the best way to get the source and doc and be able to use it in my dev environment without messing it up?
Is this as simple as running the Java 6 EE install package on Vista 64bit?
If I have the download, is there a way to开发者_JAVA百科 extract the files and manually place them?
This question is confusing. You mention Java EE 6 in the title and then Tomcat 6 in the body but Tomcat 6 doesn't implement any of the standards from Java EE 6. Sure, you can run some parts of the Java EE 6 specification on it like JSF 2.0, CDI, JPA 2.0. But still, Tomcat 6 only implements Servlet 2.5 and JSP 2.1 and has thus little to do with Java EE 6 (and Tomcat 7 also only implements Servlet 3.0, not the Java EE 6 Web profile, and they don't plan to implement it).
I'm not suggesting to move away from Tomcat if it suits your needs, I'm just clarifying that neither Tomcat 7 nor Tomcat 6 do provide a Java EE 6 (Web Profile) implementation.
If Tomcat 6 appears to be what you're looking for, you can download a "Source Code" distribution from their website (go to the bottom of the page) and attach the sources in Eclipse, as suggested by BalusC.
If you really want to "move to Java EE 6", you'll need a Java EE 6 server (either supporting the full Java EE 6 specification or only the Web Profile) like GlassFish 3.0.1, GlassFish 3.0.1 Web Profile, JBoss 6.0, Resin 4.0 (Web Profile implementation). They all provide sources of their implementation. If you go this way, let me know and I'll add more details if necessary.
The Java EE is an abstract API. The application server is the concrete implementation. The Java EE 6 kit provided by Sun Oracle contains basically the Glassfish server. But you already have Tomcat as server. Just get its source from http://tomcat.apache.org. You need to ensure that the source version matches the Tomcat version. If you're using an older version than currently latest 6.0.29, then you need to get it from the archive. It's in the /src
folder of the version folder. You can download it as zip, put it somewhere on your disk (I myself put it directly in Tomcat installation folder). Finally have Eclipse point to the zip file whenever you want to view the source for the first time (e.g. HttpServlet
and so on).
Noted should be that Tomcat 6 only implements Servlet 2.5 / JSP 2.1 which are part of Java EE 5, not 6. But it may be more than sufficient for your needs. For the remnant of the detail see @Pascal's answer.
精彩评论