Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (807)
Games in Android Showcase (239)
games submitted by our members
Games in WIP (872)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  A NON-ideal modular configuration for Eclipse with JavaFX  (Read 4105 times)
0 Members and 1 Guest are viewing this topic.
Offline Wiki Duke


« Posted 2019-12-19 19:35:12 »

Following is a non-ideal setup that somewhat works for using OpenJFX with OpenJDK 9+. (Written 12/19/19)

Works: ability to develop and test and run the program from Eclipse.

Doesn't: uses the "default" module (in other words, all modules), and I haven't worked out the steps to make a runnable jar.

My method for compiling, at this point, is to package the source code in a jar or zip, and unpack in a new directory, then add the folder and file and compile via the command line. This includes copying assets into the compiled jar. The compiled version is then jlinked into a self-contained project. The extra steps are annoying, but only take a minute or three, and don't have to be done very often.

My hope: this guide will quickly become OBSOLETE and is replaced when *someone* figures out a better way to configure Eclipse.

For installing OpenJFX, I am assuming one uses the guide and environment variables specified in Gluon's documentation.

Eclipse "Build Path" libraries: I have named the library JavaFX13, and it is linked to the JavaFX SDK, and placed on the "Classpath"

To add this library (first time only):
  • in the Configure Build path area, under libraries, with "Classpath" highlighted, select "Add Library..."
  • a form captioned "Add Library" appears, select "User library"
  • a form captioned "Select Library" appears, click the button "User libraries..."
  • a form captioned "User Libraries" appears, click the button "New"
  • a popup form captioned "New Library appears, enter your name for the library, e.g., "JavaFX13" and click OK
  • the form captioned "User Libraries" reappears, select your newly named library and click "Add external jars..."
  • a form captioned "JAR selection" appears, navigate to the Gluon "SDK" download (for me, I downloaded to c:/Program Files/Java/javafx-sdk-13.0.1), and then to the "/lib" subfolder. The javaFX .jar files should all be listed. Select them all and hit "Open"
  • the form captioned "User Libraries" reappears, with the new library selected, click "Apply and Close"
  • the form captioned "Select Library" reappears, with the new library selected (if not, select it), then click "Finish"
  • the form captioned "JavaBuild Path" reappears, the new library should be in the "classpath" area. Click "Apply and Close"
The above only has to be done once. After that the JavaFX library should always be selectable from the "User Libraries" area.

Eclipse/Run/Run Configurations... for the project: under the "Arguments" tab, and "VM arguments" section (the bottom of two areas), I have the following line:
    --module-path "c:\Program Files\Java\javafx-jmods-13.0.1" --add-modules=javafx.controls

There are two downloads from Gluon for enabling JavaFX with Eclipse. One is the JDK (which is in the "class path") and one is the modules (which is in the run configurations).

I tried adding the modules in the Build Libraries, Module path, but haven't figured out the correct way to do this. It would make sense for this to be the preferred way to add the needed module references (as opposed to adding VM run configurations).

OK, am looking forward to someone posting a better way to use OpenJFX with Eclipse! Hopefully, including how to compile a modular project.

I just checked the Gluon documentation (linked above). They have a tab "JavaFX 13 and Eclipse" with very similar instructions.  LOL well looky there. They also have us (for modular projects) compilation done from the command line. But the suggestion for using the environment variable PATH_TO_JAVAFX_MODS* in the run configurations VM arguments should make upgrading OpenJFX a little less of a chore.

*NOTE: the new instructions from Gluon omit creating an environment variable for the downloaded .mod files! I don't know if following the Gluon instructions which only have us create PATH_TO_JAVAFX is going to work or not. I suggest having two environment variables, one for the SDK and another for the mod files, and being careful to use the correct one (i.e., look up the syntax of the command in questions to determine which).
This wiki entry has had 0 revisions with contributions from 1 members. (more info)
Pages: [1]
  ignore  |  Print  

Riven (843 views)
2019-09-04 15:33:17

hadezbladez (5778 views)
2018-11-16 13:46:03

hadezbladez (2597 views)
2018-11-16 13:41:33

hadezbladez (6195 views)
2018-11-16 13:35:35

hadezbladez (1494 views)
2018-11-16 13:32:03

EgonOlsen (4729 views)
2018-06-10 19:43:48

EgonOlsen (5779 views)
2018-06-10 19:43:44

EgonOlsen (3270 views)
2018-06-10 19:43:20

DesertCoockie (4171 views)
2018-05-13 18:23:11

nelsongames (5481 views)
2018-04-24 18:15:36
A NON-ideal modular configuration for Eclipse with JavaFX
by philfrei
2019-12-19 19:35:12

Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!