简体   繁体   中英

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 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

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