CS305LAB1

code + art = ✨
2021-08-31

Run a Ghost JavaFX Application on Eclipse

Screenshot of the running application on eclipse

With limited instruction on the first class, getting a ghost file to run the JavaFX was quiet a journey to me. The Google sources from the other instructors are not quiet compatitble with my Eclipse and the detailed information that I was looking. If you also in that place, then this article would be a fresh breeze for your whole general idea of setting up the JavaFX Application on your Eclipse. This short guide would work best for PC, but Mac user can use the general step for their own device!

Does your PC has the available IDE, Java, and JavaFX library?

First make sure that you have those 3 items on your system.

– Use Oracle Webpage to download Java link here

– Getting JavaFX on the Openjfx link here. Make sure to save it in a folder that you can later access (this will be important for the further guide)

– Download and install the latest EclipseIDE! link here

Set up the JavaFX on Eclipse

Navigate the top bar menu

Help > Eclipse Marketplace…

Go to the search bar and type “fx”, hit ENTER. The first option should be “e(fx)clipse”, and hit INSTALL. Let it run and restart.

After that open the IDE again. Go to File > New > Project

Select a wizard should pop up and you want to find JavaFX > JavaFX Project.

Name the new project like “FirstJavaFXApplication” perhaps. Remember to not create Module!!!

You are half way done. Do you see the red x on the Application? It is there because it has not recieved any JavaFX library in the code yet. This is how you add all the library that we downloaded from Openjfx before.

Right click on the file in the Package window > Properties

Nagivate to Java Build Path, and select the Modulepath. Select Add External JARs…

A window should pop up and you should navigate to the folder that you got from JavaFX that you downloaded and unzipped before. Head to javafx-sdk-11.0.2 > lib.

Choose all the .jar files. ENTER

Click Apply and Close

Go to src > application > Main.java. Run the program, screenshoot the thing for your professor.

That is it! Contact me if you find any error or grammatical mistakes in this article.

last update on 4th March 2024