Are incompatibilities known to prevent JavaFX from running in a virtualized OS X environment?

Description of the problem

I am trying to run a simple JavaFX application as part of a virtualized OS X installation without success. When run on an OS X host system, everything works as expected.

After my research, others also stumbled upon this problem, but none of the proposed solutions seem to work:

  • Using VirtualBox instead of VMware Fusion as a virtualization tool because "VMware is not a certified hypervisor" (see this question and the official specifications )
  • I activated / deactivated 3D hardware acceleration support in the virtual machine settings.

My best approach so far has been to get the Java virtual machine to replace PRISM hardware 3D rendering with the PRISM software rendering engine (using -Dprism.order=sw , see this question ).

When using the hardware rendering engine, the JafaFX application crashes. When using the software rendering engine, the JavaFX application starts normally, but the interface elements do not appear at all.

I use the JavaFX “Hello World” application, which is generated by IntelliJ IDEA when selecting “New Project ...” → “Java FX Application”, plus adding a simple text label (see code below).

To start the JavaFX application from the command line, I call:

 java -Dprism.order=sw -jar path/to/JavaFXApp.jar 

Error message

The only error recorded on the JVM command line (even in verbose mode) is

 CGLCreateContext error: 10002 

This error is not logged on successful startup on the host system.

My settings

  • IntelliJ IDEA 14.1.1
  • JDK 1.8.0_40
  • OS X 10.9.5 (host system)
  • OS X 10.10.3 (guest OS)
  • Vmware Fusion Professional 7.1.1
  • VirtualBox 4.3.26

Code example

Main.java

 package sample; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; public class Main extends Application { @Override public void start(Stage primaryStage) throws Exception{ Parent root = FXMLLoader.load(getClass().getResource("sample.fxml")); primaryStage.setTitle("Hello World"); primaryStage.setScene(new Scene(root, 300, 275)); primaryStage.show(); } public static void main(String[] args) { launch(args); } } 

Controller.java

 package sample; public class Controller { } 

sample.fxml

 <?import javafx.scene.layout.GridPane?> <?import javafx.scene.control.Label?> <GridPane fx:controller="sample.Controller" xmlns:fx="http://javafx.com/fxml" alignment="center" hgap="10" vgap="10"> <children> <Label text="This is a 'javafx.scene.control.Label'" /> </children> </GridPane> 
+6
source share
2 answers

Same problem. According to several reports, this is a bug in the JVM.

https://bugs.openjdk.java.net/browse/JDK-8096072

0
source

It's not a mistake.

https://bugs.openjdk.java.net/browse/JDK-8154148

This is more like a Mac OS X limitation that prevents JDK from running under the VM Ware hypervisor.

I had the same problem with my application and I tried to run it under Oracle VirtualBox, but with no luck. However, on a real device, my application works great.

So, buying equipment is the only option I guess :)

0
source

Source: https://habr.com/ru/post/985189/


All Articles