[SOLVED] Random JFX error

Hey All. I have been working on a little concept in JME (3.6.1) and have started getting this error out of nowhere. The project uses io.tlf.jme for jfx and everything was working fine this morning and now all of the sudden I am getting this error and I can’t figure out why. I was only playtesting and not changing code so I am certain it is not caused by anything I changed. If I comment out the JFX UI then the game starts, but I kinda need JFX to work.

Loading library prism_d3d from resource failed: java.nio.file.AccessDeniedException: C:\Users\dream\.openjfx\cache\12\prism_d3d.dll
java.nio.file.AccessDeniedException: C:\Users\dream\.openjfx\cache\12\prism_d3d.dll
	at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89)
	at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
	at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
	at java.base/sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:270)
	at java.base/sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:105)
	at java.base/java.nio.file.Files.delete(Files.java:1141)
	at com.sun.glass.utils.NativeLibLoader.cacheLibrary(NativeLibLoader.java:281)
	at com.sun.glass.utils.NativeLibLoader.installLibraryFromResource(NativeLibLoader.java:203)
	at com.sun.glass.utils.NativeLibLoader.loadLibraryFromResource(NativeLibLoader.java:185)
	at com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:157)
	at com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:52)
	at com.sun.prism.d3d.D3DPipeline.lambda$static$0(D3DPipeline.java:48)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at com.sun.prism.d3d.D3DPipeline.<clinit>(D3DPipeline.java:44)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:315)
	at com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:187)
	at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:91)
	at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
	at java.base/java.lang.Thread.run(Thread.java:834)
Loading library glass from resource failed: java.nio.file.AccessDeniedException: C:\Users\dream\.openjfx\cache\12\glass.dll
java.nio.file.AccessDeniedException: C:\Users\dream\.openjfx\cache\12\glass.dll
	at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89)
	at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
	at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
	at java.base/sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:270)
	at java.base/sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:105)
	at java.base/java.nio.file.Files.delete(Files.java:1141)
	at com.sun.glass.utils.NativeLibLoader.cacheLibrary(NativeLibLoader.java:281)
	at com.sun.glass.utils.NativeLibLoader.installLibraryFromResource(NativeLibLoader.java:203)
	at com.sun.glass.utils.NativeLibLoader.loadLibraryFromResource(NativeLibLoader.java:185)
	at com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:157)
	at com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:52)
	at com.sun.glass.ui.Application.loadNativeLibrary(Application.java:110)
	at com.sun.glass.ui.Application.loadNativeLibrary(Application.java:118)
	at com.sun.glass.ui.win.WinApplication.access$000(WinApplication.java:39)
	at com.sun.glass.ui.win.WinApplication$1.run(WinApplication.java:101)
	at com.sun.glass.ui.win.WinApplication$1.run(WinApplication.java:82)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at com.sun.glass.ui.win.WinApplication.<clinit>(WinApplication.java:82)
	at com.sun.glass.ui.win.WinPlatformFactory.createApplication(WinPlatformFactory.java:39)
	at com.sun.glass.ui.win.WinPlatformFactory.createApplication(WinPlatformFactory.java:36)
	at com.sun.glass.ui.Application.run(Application.java:144)
	at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:279)
	at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:269)
	at javafx.application.Platform.startup(Platform.java:101)
	at io.tlf.jme.jfx.injme.JmeFxContainerImpl.initFx(JmeFxContainerImpl.java:646)
	at io.tlf.jme.jfx.injme.JmeFxContainerImpl.<init>(JmeFxContainerImpl.java:287)
	at io.tlf.jme.jfx.injme.JmeFxContainerImpl.install(JmeFxContainerImpl.java:80)
	at io.tlf.jme.jfx.injme.JmeFxContainerImpl.install(JmeFxContainerImpl.java:65)
	at io.tlf.jme.jfx.injme.JmeFxContainer.install(JmeFxContainer.java:24)
	at io.tlf.jme.jfx.JavaFxUI.<init>(JavaFxUI.java:56)
	at io.tlf.jme.jfx.JavaFxUI.initialize(JavaFxUI.java:111)
	at com.dreamwagon.wilderspace.WilderspaceApp.simpleInitApp(WilderspaceApp.java:38)
	at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:240)
	at com.jme3.system.lwjgl.LwjglWindow.initInThread(LwjglWindow.java:607)
	at com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:710)
	at java.base/java.lang.Thread.run(Thread.java:834)
Sep 06, 2023 5:13:50 PM com.jme3.app.LegacyApplication handleError
SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: no glass in java.library.path: [C:\openjdk-11.0.2_windows-x64_bin\jdk-11.0.2\bin, C:\WINDOWS\Sun\Java\bin, C:\WINDOWS\system32, C:\WINDOWS, C:/Users/dream/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.5.v20221102-0933/jre/bin/server, C:/Users/dream/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.5.v20221102-0933/jre/bin, C:\Windows\system32, C:\Windows, C:\Windows\System32\Wbem, C:\Windows\System32\WindowsPowerShell\v1.0\, C:\Windows\System32\OpenSSH\, C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common, C:\WINDOWS\system32, C:\WINDOWS, C:\WINDOWS\System32\Wbem, C:\WINDOWS\System32\WindowsPowerShell\v1.0\, C:\WINDOWS\System32\OpenSSH\, C:\Program Files\Git\cmd, C:\Program Files\dotnet\, C:\Program Files\Amazon\AWSCLIV2\, C:\Program Files\PuTTY\, %SystemRoot%\system32, %SystemRoot%, %SystemRoot%\System32\Wbem, %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\, %SYSTEMROOT%\System32\OpenSSH\, C:\Users\dream\AppData\Local\Microsoft\WindowsApps, C:\Users\dream\.dotnet\tools, C:\openjdk-11.0.2_windows-x64_bin\jdk-11.0.2\bin, ., C:\Users\dream\Desktop, ., .]
	at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:289)
	at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:269)
	at javafx.application.Platform.startup(Platform.java:101)
	at io.tlf.jme.jfx.injme.JmeFxContainerImpl.initFx(JmeFxContainerImpl.java:646)
	at io.tlf.jme.jfx.injme.JmeFxContainerImpl.<init>(JmeFxContainerImpl.java:287)
	at io.tlf.jme.jfx.injme.JmeFxContainerImpl.install(JmeFxContainerImpl.java:80)
	at io.tlf.jme.jfx.injme.JmeFxContainerImpl.install(JmeFxContainerImpl.java:65)
	at io.tlf.jme.jfx.injme.JmeFxContainer.install(JmeFxContainer.java:24)
	at io.tlf.jme.jfx.JavaFxUI.<init>(JavaFxUI.java:56)
	at io.tlf.jme.jfx.JavaFxUI.initialize(JavaFxUI.java:111)
	at com.dreamwagon.wilderspace.WilderspaceApp.simpleInitApp(WilderspaceApp.java:38)
	at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:240)
	at com.jme3.system.lwjgl.LwjglWindow.initInThread(LwjglWindow.java:607)
	at com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:710)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.UnsatisfiedLinkError: no glass in java.library.path: [C:\openjdk-11.0.2_windows-x64_bin\jdk-11.0.2\bin, C:\WINDOWS\Sun\Java\bin, C:\WINDOWS\system32, C:\WINDOWS, C:/Users/dream/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.5.v20221102-0933/jre/bin/server, C:/Users/dream/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.5.v20221102-0933/jre/bin, C:\Windows\system32, C:\Windows, C:\Windows\System32\Wbem, C:\Windows\System32\WindowsPowerShell\v1.0\, C:\Windows\System32\OpenSSH\, C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common, C:\WINDOWS\system32, C:\WINDOWS, C:\WINDOWS\System32\Wbem, C:\WINDOWS\System32\WindowsPowerShell\v1.0\, C:\WINDOWS\System32\OpenSSH\, C:\Program Files\Git\cmd, C:\Program Files\dotnet\, C:\Program Files\Amazon\AWSCLIV2\, C:\Program Files\PuTTY\, %SystemRoot%\system32, %SystemRoot%, %SystemRoot%\System32\Wbem, %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\, %SYSTEMROOT%\System32\OpenSSH\, C:\Users\dream\AppData\Local\Microsoft\WindowsApps, C:\Users\dream\.dotnet\tools, C:\openjdk-11.0.2_windows-x64_bin\jdk-11.0.2\bin, ., C:\Users\dream\Desktop, ., .]
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2660)
	at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:829)
	at java.base/java.lang.System.loadLibrary(System.java:1867)
	at com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:150)
	at com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:52)
	at com.sun.glass.ui.Application.loadNativeLibrary(Application.java:110)
	at com.sun.glass.ui.Application.loadNativeLibrary(Application.java:118)
	at com.sun.glass.ui.win.WinApplication.access$000(WinApplication.java:39)
	at com.sun.glass.ui.win.WinApplication$1.run(WinApplication.java:101)
	at com.sun.glass.ui.win.WinApplication$1.run(WinApplication.java:82)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at com.sun.glass.ui.win.WinApplication.<clinit>(WinApplication.java:82)
	at com.sun.glass.ui.win.WinPlatformFactory.createApplication(WinPlatformFactory.java:39)
	at com.sun.glass.ui.win.WinPlatformFactory.createApplication(WinPlatformFactory.java:36)
	at com.sun.glass.ui.Application.run(Application.java:144)
	at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:279)
	... 14 more

Ok. figured it out. I had my map editor program running along side my app and it was locking the JFX cache directory.

3 Likes

Out of curiosity, does this mean we can not run two JFX apps simultaneously?

The issue is that io.tlf.jme jme-jfx has open-jfx 12 in its pom definition and therefore uses the same cache directory for each app. You could get around the issue by choosing different minor versions of jfx. To get it working with maven you would have to exclude version 12 in one of the projects and pick say 12.0.1 (or any higher version really), and it will work.

If including jars manually then it should just work by picking different versions of jfx

         <dependency>
			<groupId>io.tlf.jme</groupId>
			<artifactId>jme-jfx</artifactId>
			<version>1.2.1</version>
			<exclusions>
		        <exclusion>
      				<groupId>org.openjfx</groupId>
     			    <artifactId>javafx-graphics</artifactId>
		        </exclusion>
		        <exclusion>
		            <groupId>org.openjfx</groupId>
     			    <artifactId>javafx-controls</artifactId>
		        </exclusion>
		        <exclusion>
		            <groupId>org.openjfx</groupId>
    				<artifactId>javafx-base</artifactId>
		        </exclusion>
		    </exclusions>
		</dependency>
1 Like

So this implies that two apps that happen to use the same version of JFX will not run at the same time.

…which to me means JavaFX is very broken and we should all back away slowly.

Or, sharing this directory is supposed to be fine and is somehow not in that environment.

1 Like

I tested and the issue does not occur with vanilla JFX. I think perhaps it is due to the way io.tlf.jme jme-jfx has added specific libraries and runtimes in their pom, which makes me think it is the latter.

Can you provide a minimal reproducible sample?

I can take a look at it.

Edit: I would highly advise against attempting to run multiple JFX versions within the same app.

Just create 2 different projects in whatever IDE you use and include it in pom.

	<dependency>
  	  <groupId>io.tlf.jme</groupId>
	  <artifactId>jme-jfx</artifactId>
	  <version>1.2.1</version>
	</dependency>

Create the most simple app in each. And run one, leave it running and then run the other. I was using windows 11 home.

	@Override
	public void simpleInitApp() {

		JavaFxUI.initialize(this);

		Button button = new Button("Click Me");
		VBox vBox = new VBox(button);
		vBox.getStyleClass().add("background");
		vBox.setSpacing(15);
		vBox.setAlignment(Pos.CENTER);

		JavaFxUI.getInstance().attachChild(vBox);
}