• __DIR__ -- returns the URL of the directory that contains the current FX source file. This may be a JAR url if the current file was loaded from a jar file.
  • __FILE__ -- returns the URL of the current (class) file.
  • __PROFILE__ -- is either one of "mobile", "desktop" or "browser" depending on which environment the script is executing in (but raises a compile error).


import javafx.stage.*;
import javafx.scene.*;
import javafx.scene.text.*;

Stage {
    title  : 'Magic Constants'
    scene  : Scene {
        width  : 500
        height : 200
        content: Text {
            x: 10, y: 50
                "__DIR__: {__DIR__}\n"
                "__FILE__: {__FILE__}\n"


Community content is available under CC-BY-SA unless otherwise noted.