是否存在阻止JavaFX在虚拟化OS X环境中运行的已知不兼容性? [英] Are there known incompatibilities that prevent JavaFX from running in a virtualized OS X environment?

查看:610
本文介绍了是否存在阻止JavaFX在虚拟化OS X环境中运行的已知不兼容性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题描述



我试图在虚拟化OS X安装中运行一个简单的JavaFX应用程序,但没有成功。当在OS X主机系统上本地启动时,一切都按预期工作。



根据我的研究,其他人也发现了这个问题,但没有一个建议的解决方案似乎工作:




  • 使用VirtualBox而不是VMware Fusion作为虚拟化工具,因为VMware不是经过认证的虚拟机管理程序(请参阅​​此问题官方规格

  • 我已在虚拟机的设置中启用/停用3D硬件加速支持。



我最好的方法是提示Java VM用PRISM软件渲染引擎替换PRISM硬件3D渲染引擎使用 -Dprism.order = sw ,请参阅此问题)。



使用硬件渲染引擎时,JafaFX应用程序崩溃。当使用软件渲染引擎时,JavaFX应用程序启动很好,但没有显示UI元素。



我使用的是JavaFXHello World应用程序,它由IntelliJ IDEA在选择New Project ... - >Java FX Application时生成,并添加一个简单的文本标签(见下面的代码)。



要从命令行运行JavaFX应用程序,我打电话:

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



错误消息



JVM(即使在详细模式下)记录到命令行的唯一错误是

  CGLCreateContext错误:10002 

运行时不会记录此错误



我的规格




  • IntelliJ IDEA 14.1.1

  • JDK 1.8.0_40

  • OS X 10.9.5(主机操作系统)

  • OS X 10.10。 3(guest OS)

  • Vmware Fusion Professional 7.1.1

  • VirtualBox 4.3.26



示例代码



Main.java

 包样本; 

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent
import javafx.scene.Scene;
import javafx.stage.Stage;

public class Main extends应用程序{

@Override
public void start(Stage primaryStage)throws Exception {
父root = FXMLLoader.load ().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

 包样本; 

public class Controller {
}

.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 =10vgap =10>
< children>
< Label text =这是一个'javafx.scene.control.Label'/>
< / children>
< / GridPane>


解决方案



https://错误。 openjdk.java.net/browse/JDK-8154148



它更像是一个Mac OS X限制,阻止JDK在VM Ware虚拟机管理程序下运行。 p>

我有与我的应用程序相同的问题,并试图运行它在Oracle VirtualBox以及没有运气。但是,在真实设备上我的应用程序工作正常。



所以,购买硬件是唯一的选择,我猜:)


Problem Description

I've been trying to run a simple JavaFX application within a virtualized OS X installation, without success. When launched natively on the OS X host system, everything works as expected.

Following my research, others have stumbled upon this issue as well, but none of the suggested solutions seem to work:

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

My best approach so far was to prompt the Java VM to replace the PRISM hardware 3D render engine with the PRISM software render engine (by using -Dprism.order=sw, see this question).

When using the hardware render engine, the JafaFX application crashes. When using the software render engine, the JavaFX application starts up fine, but no UI elements are displayed at all.

I'm using the JavaFX "Hello World" application, that gets generated by IntelliJ IDEA when choosing "New Project..." -> "Java FX Application", plus adding a simple text label (see code below).

To run the JavaFX application from the command-line, I'm calling:

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

Error Message

The only error logged to the command-line by the JVM (even in verbose mode) is

CGLCreateContext error: 10002

This error is not logged when run successfully on the host system.

My Specs

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

Sample Code

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>

解决方案

It's not a bug.

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

It's more like a Mac OS X restriction which prevents JDK from running under VM Ware hypervisor.

I had the same issue with my app and tried to run it under Oracle VirtualBox as well with no luck. However, on real device my app works fine.

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

这篇关于是否存在阻止JavaFX在虚拟化OS X环境中运行的已知不兼容性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆