JDK-8196824 : Implement a security permission to prevent exiting FX application with javafx.application.Platform.exit()
  • Type: Enhancement
  • Component: javafx
  • Sub-Component: application-lifecycle
  • Affected Version: jfx11,9,10
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: windows_7
  • CPU: x86_64
  • Submitted: 2018-02-04
  • Updated: 2025-06-17
  • Resolved: 2025-06-17
Related Reports
Relates :  
Description
A DESCRIPTION OF THE REQUEST :
javafx.application.Platform.exit() exits FX application and JVM even if permission exitVM is not granted by SecurityManager.



JUSTIFICATION :
It is possible to prevent exiting JVM with SecurityManager with permission exitVM.
However, this permission does not prevent exiting JVM with  javafx.application.Platform.exit(). 

This is inconsistent and unexpected behavior. 

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Two options:

1) If exitVM is not granted to a class, FX application should throw an exception when an instance of this class calls javafx.application.Platform.exit(). FX application should not terminate.

2) Implement a new target for javafx.util.FXPermission to prevent exiting FX application by calling javafx.application.Platform.exit().
ACTUAL -
When an instance of a class from an external library calls javafx.application.Platform.exit(), FX application and JVM exit even if exitVM is not granted to this instance by SecurityManager. 


Comments
JavaFX no longer supports running with the security manager, so there is no reason to implement this enhancement.
17-06-2025