Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 356
Volodymyr Levytskyi Avatar asked Sep 18 '13 12:09

Volodymyr Levytskyi


People also ask

Where is JavaFX located?

For Windows. The default installation location is C:\Program Files\JavaFX\javafx-sdk- version.

What is source attachment in eclipse?

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.


2 Answers

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.

like image 42
jewelsea Avatar answered Sep 26 '22 19:09

jewelsea


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

like image 155
JodaStephen Avatar answered Sep 24 '22 19:09

JodaStephen