I decided to learn JavaFX. I need to browse source code of classes like javafx.scene.layout.StackPane
.
So I pressed F3 to go to source code. There is no source code and no button that allows to attach source code.
I looked in the Internet and din't find anything helpful.
I use eclipse kepler and java7.
I have jfxrt.jar in my classpath.
For Windows. The default installation location is C:\Program Files\JavaFX\javafx-sdk- version.
The Source Attachment dialog can be reached in several ways: Select a JAR in the Package Explorer and choose Properties > Source Attachment from the context menu or the File menu. Open the Java Build Path page of a project (File > Properties > Java Build Path). On the library page select a JAR and press Attach Source.
Recommended - use Java 8 + e(fx)clipse
I believe if you use the recommended e(fx)clipse plugin for JavaFX development and a recent Oracle (Java 8+) JDK, then the Eclipse IDE will automatically be configured to be aware of the JavaFX sources.
Otherwise manually attach sources
If this doesn't work for you, then you can follow JodaStephan's suggestion of attaching sources manually.
For Java 7 users
If you must use Java 7 rather than Java 8, then full source won't be available as JavaFX was only fully open sourced for Java 8. However, you can view some of the source by manually downloading the source code as described at: Where can I download the JavaFX 2.2 source code?, then manually attaching sources. I do not recommend use of Java 7 for JavaFX development or runtime as there were many bug fixes and improvements in Java 8 which are not ported to Java 7.
Disclaimer
I'm not an Eclipse user and haven't tried some of these options.
For Java SE 8, the JavaFX source code is distributed with the JDK. If Eclipse does not pick it up automatically, you need to select the zip file using the standard "Attach Source" approach. The file is called javafx-src.zip
and is located alongside src.zip
in the root of the unpacked Oracle JDK (on Windows).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With