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.

- 31,968
- 17
- 99
- 158

- 3,364
- 9
- 46
- 83
-
3Googled "javafx source code" : http://stackoverflow.com/questions/13553375/where-can-i-download-the-javafx-2-2-source-code – Marc Sep 18 '13 at 12:07
-
Thanks but it is for openjdk. I use java 1.7.0_17_b02. Also it does not say anything about showing javafx source code in eclipse – Volodymyr Levytskyi Sep 18 '13 at 12:12
-
2ok, well this is probably because the source code for the oracle jdk is not avaiable. Look at this : http://www.oracle.com/technetwork/java/javafx/overview/faq-1446554.html#4 – Marc Sep 18 '13 at 12:21
-
1and this should show you how to attach source and javadoc in eclipse : http://stackoverflow.com/questions/122160/is-there-an-easy-way-to-attach-source-in-eclipse – Marc Sep 18 '13 at 12:25
-
1Thanks Mark for replies. Actually I did not find source code of JavaFX2 or openjfx. I have no idea where to get source code – Volodymyr Levytskyi Sep 18 '13 at 14:07
-
1You can have a look there, I think it explains how to get the source : https://wiki.openjdk.java.net/display/OpenJFX/Building+OpenJFX#BuildingOpenJFX-GettingtheSources – Marc Sep 18 '13 at 14:11
-
You are right! I downloaded sources using TortoiseHg. But I cannot attach sources to jfxrt.jar because it is not allowed by eclipse, it says that Source attachment is not modifiable for my jfxrt.jar. Don't you know how to resolve this? – Volodymyr Levytskyi Sep 18 '13 at 16:07
2 Answers
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).

- 60,927
- 15
- 95
- 117
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.
-
i have the e(fx)clipse plugin, and it did not make eclipse javafx source-aware. i had to extract the javafx source from my jdk, then attach the external folder of javafx sources to the class in the ide. – liltitus27 Feb 08 '17 at 20:56