23

OS: OSX Mountain Lion.

System: Virtual BOX 4.2.6.

Java: 1.7.0.40-ea-b34

I want to disable hardware acceleration for my JAVAFX app because there is no HW acceleration on my system (mac). So when there is no HW acceleration I am getting fatal error on executing my JAVAFX App. The error related to "Prism Engine pipeline" and it happen when java trying to execute openGL native libs. So i want to disable the prism.

I see there is some vm args that control prism behavior like.. Dprism.forceGPU=true;

Is there anything like above to disable prism or openGL requesting?

The Fatal error (openGl related codes)

Stack: [0x000000016c8f9000,0x000000016c9f9000], sp=0x000000016c9f7f40, free space=1019k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [libobjc.A.dylib+0x639f] objc_msgSend_fixup+0x5f
C [AppKit+0x28134c] -[NSOpenGLContext initWithFormat:shareContext:]+0xac
C [libprism-es2.dylib+0x4e9f] createContext+0x1b3
C [libprism-es2.dylib+0x4729] Java_com_sun_prism_es2_gl_mac_MacGLFactory_nInitialize+0xa2
j com.sun.prism.es2.gl.mac.MacGLFactory.nInitialize([I)J+0
j com.sun.prism.es2.gl.mac.MacGLFactory.initialize(Ljava/lang/Class;Lcom/sun/prism/es2/gl/GLPixelFormat$Attributes;)Z+73
j com.sun.prism.es2.ES2Pipeline.<clinit>()V+54 
Lalith J.
  • 1,391
  • 4
  • 16
  • 27
  • What kind of Mac and OS version is it? I thought all Macs running a supported OS X 10.7.3+ were equipped with the minimum hardware to support JavaFX 2.x hardware acceleration. – jewelsea Sep 12 '13 at 04:45
  • 1
    Actually this is not a physical MAC.. this is a virtual mac system on virtual Box and VB not support for 3d acceleration. – Lalith J. Sep 12 '13 at 10:45
  • 2
    It would seem that this [configuration should work out of the box](http://www.oracle.com/technetwork/java/javafx/downloads/supportedconfigurations-1506746.html) "All certified platforms are also certified when virtualized in a certified hypervisor, except where noted. Certified hypervisors are: Oracle VM 2.2, VirtualBox 3.x, 4.x", as it doesn't work straight away, you might want to [log a bug report](https://javafx-jira.kenai.com). – jewelsea Sep 12 '13 at 21:15
  • 3
    As Mr zenbeni said -Dprism.order=j2d working perfectly with java 7. Mr Petr Solution -Dprism.order=sw not working. the error is "not suitable pipeline found". I think it only work with java 8. Thank you all Problem Solved :). – Lalith J. Sep 12 '13 at 22:08

2 Answers2

36

The j2d graphics pipeline is kind of deprecated in JavaFX 8, so it's better to use the software pipeline: -Dprism.order=sw. To verify that you are actually using it you could switch on logging: -Dprism.verbose=true

Petr
  • 5,999
  • 2
  • 19
  • 25
  • Is `-Dprism.order=sw` new and only available in Java 8? For Java 7 will `-Dprism.order=sw` work or do you need to use the kind of deprecated j2d pipeline `-Dprism.order=j2d` like zenbeni's answer? – jewelsea Sep 12 '13 at 21:08
  • I'm not quite sure about FX 7. You could check it using the verbose mode. – Petr Sep 12 '13 at 21:15
  • 1
    `-Dprism.order=sw` is not working in Java 7, tested on MacOS 10.8.5 and Windows 7 64bit. – bobndrew Oct 17 '13 at 10:03
  • I use it but when I have a really big image it is truncated. In logs I have only : "Growing pool com.sun.prism.sw.SWTexturePool@542d472e target to 147 837 360" . Picture has 4,4MB. How can I workaround it ? – VANILKA Sep 18 '18 at 09:48
  • 2
    Old answer but still very valuable! On my JavaFx app The CPU load was reduced by around 20% (at standstill CPU load was 20-25% and is now under 5%) on Java 11 under Linux Debian by setting `-Dprism.order=sw`. `-Dprism.verbose=true`reported using `es2` as first choice. – HelloWorld Jun 23 '19 at 05:07
  • sw works but in our case the buttons were not visible, wrongly rendered, and j2d fixed the issue (even if it's obsolete) – Jean-François Fabre Sep 29 '21 at 09:16
14

Look at this forum: https://forums.oracle.com/message/11018975

Add this to your java execution:

-Dprism.order=j2d

That should do the trick.

zenbeni
  • 7,019
  • 3
  • 29
  • 60
  • It fixes the crash but forms are not rendered properly – Andreas May 19 '16 at 14:02
  • 3
    please note this is deprecated as of https://bugs.openjdk.java.net/browse/JDK-8095989, you should use `-Dprism.order=sw`, which uses the software emulation pipeline rather than the DirectX 2D pipeline. – Groostav Feb 27 '17 at 22:28