I created a demo JavaFX application to demonstrate cross-platform applications and then ran it on various platforms (i.e. Windows, Linux, and Mac).
package crossplatformdemo;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Tooltip;
import javafx.scene.effect.Effect;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class CrossPlatformDemo extends Application
{
public static void main(String[] args)
{
launch(args);
}
@Override
public void start(Stage Window) throws Exception
{
StackPane Layout = new StackPane();
Scene scene = new Scene(Layout,400,200);
Button button = new Button("Click Here");
//button
{
button.setTooltip(new Tooltip("Nothing Will Happen"));
Layout.getChildren().add(button);
}
//Window
{
Window.setResizable(false);
Window.setTitle("Cross Platform Demo");
Window.setScene(scene);
Window.show();
}
}
}
Works perfectly fine on:-
Windows 10
Ubuntu 16.04.3 LTS
But show a blank Application window on Mac OS.
along with the error.
2018-01-02 CGLChoosePixe1Format error: 10002
2018-01-02 CGLCreateContext error: 10002
How can I run it on Mac OS?
Running Java 8, Ubuntu on VirtualBox, Mac OS High Sierra on VMWare. Used physical windows machine.
Edit: Following suggestions, tried running the app with and without 3D acceleration, and reinstalling VMware Tools. It made no difference.
verbose output
Rachits-Mac:dist rachit$ java -Dprism.verbose=true -jar CrossPlatformDemo.jar
Prism pipeline init order: es2 sw
Using native-based Pisces rasterizer
Using dirty region optimizations
Not using texture mask for primitives
Not forcing power of 2 sizes for textures
Using hardware CLAMP_TO_ZERO mode
Opting in for HiDPI pixel scaling
Prism pipeline name = com.sun.prism.es2.ES2Pipeline
Loading ES2 native library ... prism_es2
succeeded.
GLFactory using com.sun.prism.es2.MacGLFactory
(X) Got class = class com.sun.prism.es2.ES2Pipeline
GraphicsPipeline.createPipeline: error initializing pipeline com.sun.prism.es2.ES2Pipeline
*** Fallback to Prism SW pipeline
Prism pipeline name = com.sun.prism.sw.SWPipeline
(X) Got class = class com.sun.prism.sw.SWPipeline
Initialized prism pipeline: com.sun.prism.sw.SWPipeline
vsync: true vpipe: false
2018-01-02 16:58:51.904 java[561:8835] CGLChoosePixelFormat error: 10002
2018-01-02 16:58:51.904 java[561:8835] CGLCreateContext error: 10002
Loading Prism common native library ...
succeeded.
QuantumRenderer: shutdown
Tried with Software Emulation
Rachits-Mac:dist rachit$ java -Dprism.order=sw -Dprism.verbose=true -jar CrossPlatformDemo.jar
Prism pipeline init order: sw
Using native-based Pisces rasterizer
Using dirty region optimizations
Not using texture mask for primitives
Not forcing power of 2 sizes for textures
Using hardware CLAMP_TO_ZERO mode
Opting in for HiDPI pixel scaling
*** Fallback to Prism SW pipeline
Prism pipeline name = com.sun.prism.sw.SWPipeline
(X) Got class = class com.sun.prism.sw.SWPipeline
Initialized prism pipeline: com.sun.prism.sw.SWPipeline
vsync: true vpipe: false
2018-01-02 16:59:43.619 java[564:9126] CGLChoosePixelFormat error: 10002
2018-01-02 16:59:43.619 java[564:9126] CGLCreateContext error: 10002
Loading Prism common native library ...
succeeded.
QuantumRenderer: shutdown
The app crashed when using "j2d" and had to force quit.
Rachits-Mac:dist rachit$ java -Dprism.order=j2d -Dprism.verbose=true -jar CrossPlatformDemo.jar
Prism pipeline init order: j2d
Using native-based Pisces rasterizer
Using dirty region optimizations
Not using texture mask for primitives
Not forcing power of 2 sizes for textures
Using hardware CLAMP_TO_ZERO mode
Opting in for HiDPI pixel scaling
WARNING: The prism-j2d pipeline should not be used as the software
fallback pipeline. It is no longer tested nor intended to be used for
on-screen rendering. Please use the prism-sw pipeline instead by setting the "prism.order" system property to "sw" rather than "j2d".
*** Fallback to Prism SW pipeline
Prism pipeline name = com.sun.prism.j2d.J2DPipeline
(X) Got class = class com.sun.prism.j2d.J2DPipeline
Initialized prism pipeline: com.sun.prism.j2d.J2DPipeline
vsync: true vpipe: false
2018-01-02 17:00:34.549 java[570:9763] CGLChoosePixelFormat error: 10002
2018-01-02 17:00:34.549 java[570:9763] CGLCreateContext error: 10002
QuantumRenderer: shutdown
Here's version info if needed:-
- Java Runtime Environment: build 1.8.0_152-b16.(Tried with Java 9, same behavior).
- MAC: Darwin Kernel Version 17.0.0