Volodymyr Levytskyi
Volodymyr Levytskyi

Reputation: 3432

How to see source code of JavaFX SDK in eclipse kepler?

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.

Upvotes: 5

Views: 4728

Answers (2)

jewelsea
jewelsea

Reputation: 159386

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.

Upvotes: 2

JodaStephen
JodaStephen

Reputation: 63385

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

Upvotes: 8

Related Questions