I developed this Demo JavaFX application to demonstrate the working of cross-platform applications. So I wrote and compiled this Java Code and ran it on Windows, Linux, Mac OS.
Demo Application Running on Windows 10
Demo Application Running on Ubuntu 16.04.3 LTS
Demo Application Running on Zorin OS 12
It works perfectly fine on Windows and Linux. But show a blank Application window on Mac OS.
Demo Application Running on Mac OS High Sierra
along with this error message. I don't understand this error message
Terminal Error Message
How can I run this application on Mac OS?
I used Java 8. I made this on Netbeans IDE, and I used VirtualBox to Run Ubuntu, Zorin. Used VMWare for Mac OS High Sierra. Used my physical machine for Windows Output.
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();
}
}
}
Edit: After following your advice, I tried running the app with and without 3D acceleration, Uninstalling and Updating VMware Tools but still shows the blank window.
Here is the verbose for command
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 this 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
App crashed after I used "j2d"
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
Demo App Had to be forced to quit
Mac OS Version 10.13
Rachits-Mac:~ rachit$ uname -a
Darwin Rachits-Mac.local 17.0.0 Darwin Kernel Version 17.0.0: Thu Aug 24 21:48:19 PDT 2017; root:xnu-4570.1.46~2/RELEASE_X86_64 x86_64
My Java Version
Rachits-Mac:~ rachit$ java -version
java version "1.8.0_152"
Java(TM) SE Runtime Environment (build 1.8.0_152-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)
Rachits-Mac:~ rachit$ javac -version
javac 1.8.0_152
I even tried this with Java 9, did not work