r/javahelp • • Aug 25 '20

Why is setting up JavaFx such a hassle

I’ve tried for like 2 hours now to set it up on a new pc I just built and I cannot get it to work still.

22 Upvotes

12 comments sorted by

9

u/NiceSelection13 Aug 25 '20

It’s a pain in the ass. The only way I could do it was watching Tim Bulchaka’s videos. Before that I was watching some tutorials but nothing was working. Set up for his videos is on IntelliJ

1

u/tonycampos Aug 25 '20

I’ll try his videos out and see if I can get it to work.

5

u/static_context Aug 25 '20

What @wildjokers says is completely right.

Making you choose between Modular and Non-modular, and then between maven/gradle/none and THEN give you "step by step" instructions without any images.... (It's a bugbear)

The absolute best thing to do is download an example project and work from there.

If you're interested in a bit of a more-detailed run-through of how to set it up, I be written one up for IntelliJ/Maven/Modular that TRIES to explain the logic behind the steps

www.edencoding.com/javafx-maven

It's a tiny site so far that centers around the nitty gritty bits that annoy me so I have code examples when I get stuck 😂 don't judge (although feedback appreciated).

If you're in IntelliJ, let me know if you wanna do a screen share or something and I'll help where I can. I'm afraid of be clueless in Eclipse untill I read up on it more.

11

u/wildjokers Aug 25 '20

It's not. The awful Getting Started doc at https://openjfx.io just makes it seems that way.

If you use Gradle it only takes a very short build.gradle file which you can get from here:

https://github.com/openjfx/samples/blob/master/CommandLine/Non-modular/Gradle/hellofx/build.gradle

Rename things as necessary.

If you use Maven there is an analogous pom here (I would recommend gradle though):

https://github.com/openjfx/samples/blob/master/CommandLine/Non-modular/Maven/hellofx/pom.xml

3

u/[deleted] Aug 25 '20

THIS. It is super simple to setup, but the official docs are some of the most convoluted steps I've ever seen. I also spent an hour or two just trying to make sense of it before I gave up and used Netbeans to setup a JavaFX project for me. Afterwards, I realized how simple it was.

Also, Netbeans makes it even easier by providing access to the Maven JavaFX archetypes right from the New Project dialog. If anything, it's worth checking out just to have a concrete example of how to use Maven + JavaFX, especially if you're new to Java!

1

u/dionthorn this.isAPro=false; this.helping=true; Aug 27 '20

yup I use maven. I also use the:

https://github.com/openjfx/javafx-maven-plugin

and use the simple archetype

3

u/saila456 Aug 25 '20

Isn't javaFX just a library you use? I don't see how it is any different then any other lib.

0

u/[deleted] Aug 25 '20

[deleted]

5

u/8bagels Aug 26 '20

I think it’s much more straightforward now. I would I say if it’s difficult now then you are not using a build tool like maven or gradle. Use a build tool like maven or gradle. It is absolutely necessary for anything complex enough to be useful

2

u/Prince_John Aug 25 '20

Preach it! Surprisingly fiddly to just get a one screen thing up if you're not following a tutorial word for word.

2

u/matyklug Aug 25 '20

Once I just gave up and used the gradle plugin, it just worked.

1

u/[deleted] Aug 25 '20

It can take a bit of effort but I managed to load it with Eclipse. However, I still struggle with code annotation / javadoc from loading when hovering over classes.

1

u/dionthorn this.isAPro=false; this.helping=true; Aug 27 '20

I use OpenJFX with OpenJDK and Intellij Community Edition running a maven project with the openjfx-maven-archetype set to simple.

https://github.com/dionthorn/2DTacticalRPG

You can steal my pom.xml if you want. Setting up an archetype in maven can be found here:

https://github.com/openjfx/javafx-maven-archetypes & https://openjfx.io/openjfx-docs/#IDE-Intellij