Introduction
In most Linux distribution is the source code for OpenJDK already available via RPM or Debian Package, but not for RHEL 6. The reason is probably the RHEL 6 main aim is for server OS and not for client development. Anyhow here is the way to make the source code available in Eclipse.
Installation
First you need to download the source zip from http://download.java.net/openjdk/jdk7/.
Then move the zip to the java home directory and name it src.zip.
$ cp /home/magnus/Downloads/jdk7u-ea798405286d.zip /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.51.x86_64/src.zip
Finally restore SELinux security policy.
$ restorecon -RFv /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.51.x86_64/src.zip
$ restorecon reset /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.51.x86_64/src.zip context unconfined_u:object_r:lib_t:s0->system_u:object_r:lib_t:s0
Test
If everything works fine, you should now be able to browse the java source code from Eclipse.
Troubleshoot
If the source code is not directly found, you might need to adjust the java home search path.
If that did not help, you could also verify the path to the source zip.
Finally you might need to restart Eclipse (I did not). Happy coding!
No comments:
Post a Comment