Eclipse with JDK in Ubuntu 10.04
A short question: My eclipse project is set to use the "sun-java-6-jdk"-supplied JDK library, but I cannot Ctrl-click to view source (no source attached), as I can开发者_JAVA技巧 do out-of-the-box on Windows. How do I make this work?
You need to install the openjdk-6-source package and to attach the sources (located in /usr/lib/jvm/java-6-openjdk/src.zip
) to the JDK under Eclipse.
Personally, I prefer to use sun-java6-jdk - the source package being sun-java6-source - that you can get from the Canonical Partner Repository:
deb http://archive.canonical.com/ lucid partner
Then, attach the sources located in /usr/lib/jvm/java-6-sun/src.zip
Presumably that's because it hasn't got source with the JAR so it's not finding it automatically. Your best bet is to consult the ubuntu package manager and see if there's a src, or if it's elsewhere on your system (/use/src or /use/local are places to start looking).
Once you've got it, you can right-click on the JAR in the project and point to the location of the Java source in the "source" property.
I think you need to go to the settings for your installed JRE, edit it, and set the source attachments manually.
Here's a link to Eclipse's help: http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.jdt.doc.user/reference/preferences/java/debug/ref-installed_jres.htm
精彩评论