简体   繁体   中英

How do you install the source for Java 6 libraries in Eclipse?

What's the best way to install the source code for the java libraries in Eclipse 3.6. I have attempted to follow the accepted answer here ( How Do You Install the source for the java libraries in Eclipse? ), but that didn't work. I have java ee sdk 6 installed. Also, where can I find the source code? There isn't a src.zip in my jdk. I downloaded jdk-6u23-fcs-src-b05-jrl-12_nov_2010 and ran the jar, but I'm not sure that's what I want either. I just want to be able to ctrl click on java classes to go to the selected class.

You must have a src.zip in the JDK install folder. Reinstall JDK if necessary. There's by the way no means of a JAR. Go to Java SE download page and press the leftmost one of the four big buttons to get the JDK. By the way, if you have the JDK installed already and run Eclipse 3.6 for the first time, it should automatically have included the source. Regardless, you may find this tutorial useful to restart clean. You can just skip the JSF part if that's not of your interest.

For the Java EE API you should grab the container's source code. You're probably using Tomcat as Eclipse automatically recognizes Glassfish source code. In case of Tomcat, you would need to download it separately from the Tomcat home page (it's the Source Code Distributions at the very bottom of the page). It's a ZIP file. Just open a random Java EE class, eg HttpServlet , press the Source button and point the ZIP file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM