Jme in javafx

Is jme in javafx still possible?



I tried to build it on Eclipse + LibericaJDK 11 and got the following error:.

The type com.sun.javafx.embed.EmbeddedStageInterface is not accessible

Access is probably prohibited by JPMS. If so, is jme in javafx already impossible? It affects the design of my application.

javafx in jme still seems to work, but not jme in javafx.

Thank you for reading.

I’m quite certain jmonkeybuilder put jme in a javafx pane, though you’ll have to sift through the code to see how he did it. I’ve only ever put jme in a swing Panel.

https://bitbucket.org/JavaSabr/jmonkeybuilder/src/master/

1 Like

At LibericaJDK 11 + compiler compliance level 10, I failed to build the jmonkeybuilder. This error is most likely due to JPMS.

The type com.sun.javafx.iio.ImageFrame is not accessible

jmonkeybuilder might have some useful information, but you might just conclude that JPMS made jme in javafx impossible. The loss of access to javafx’s internal packages can mean that.

This method did not solve this problem.

jmonkeybuilder 1.8 .0 .msi works. I think it’s self-contained. This means that it works with certain versions of the JDK.

I will give up jme in javafx.

Some people see an obstacle and see it as a challenge. Others a reason to give up. I’m as certain as I can say without actually writing it myself that it’s entirely possible.

Access restrictions are eliminated if you override the JPMS module access rules at runtime. I’m using JavaFX in jME (not the other way around), and I have the following section in the run task of my build.gradle file:

jvmArgs = [
		"--add-opens", "javafx.graphics/com.sun.javafx.embed=ALL-UNNAMED",
		"--add-opens", "javafx.graphics/com.sun.javafx.stage=ALL-UNNAMED",
		"--add-opens", "javafx.graphics/com.sun.javafx.cursor=ALL-UNNAMED",
		"--add-opens", "javafx.graphics/com.sun.glass.ui=ALL-UNNAMED",
		"--add-opens", "javafx.graphics/com.sun.javafx.application=ALL-UNNAMED"
	]

You may need to open a different set of packages for jME in JavaFX, but it’s the same process.

1 Like

Is it worth the effort anyway? Maybe it’s possible, but what do you gain embedding JME? My tests in the past always had far worse performance doing this, so that makes it even less interesting, unless I’m missing the point.

2 Likes