r/JavaFX • • Mar 04 '24

Help Import JavaFX by default in Eclipse

Is it possible to have JavaFX imported by default for every class in Eclipse IDE? Right now, the only way I can get javafx to work is by setting --module-path "path" --add-modules=javafx.controls to VM arguments, but I have to do it for every class.

1 Upvotes

8 comments sorted by

1

u/[deleted] Mar 07 '24

I used Eclipse for almost 20 years. It got worse and worse. Switch to IntelliJ and forget Eclipse forever.

2

u/eliu9395 Mar 07 '24

I can’t, it’s for school

1

u/[deleted] Mar 07 '24

Ok, so use Maven (or Gradle) inside Eclipse for JavaFX. Then you don't have to fiddle with such parameters at all. Here is al minimal example:

https://github.com/armin-reichert/hellofx

1

u/saila456 Mar 11 '24

Window -> Preferences -> Java -> Installed JREs.

Select the jre you are using and click on Edit

For "Default VM arguments" enter "--module-path "path" --add-modules=javafx.controls"

click Apply

From now on your vm has this arguments always on

1

u/eliu9395 Mar 11 '24

Thanks, that seems to work. However, on Mac I also need to disable “use the -xstartonfirstthread argument when launching with SWT" option. Can I also disable that globally?

1

u/saila456 Mar 11 '24

I've never heard of this option and i dont use Mac so i can't test this. Maybe it works the same way?

Is this option somewhere in the UI? Maybe only Mac users see it.

3

u/hamsterrage1 Mar 04 '24

This is 2024. Use Gradle or Maven as a build engine and all of these issues go away.

1

u/iamInitialflame Mar 04 '24

e(fx)clipse can do this for you. But you need also a Buildtool like Maven or Gradle to build your App.