This discussion is archived
8 Replies Latest reply: Dec 19, 2012 11:24 AM by jsmith RSS

MacOS: Process Manager initialize, can't full enable Headless mode.

edward17 Newbie
Currently Being Moderated
Anyone know why this error is generated in MacOs? why is it even TRYING to enable headless mode - I don't have a headless app!

[JSPAppKitAWT markAppIsDaemon]: Process manager already initialied: can't fully enable headless mode.

This only happens on a Mac, not on a PC.

(I think this is causing a Mac only issue when I try to use a JFXPanel.)
  • 1. Re: MacOS: Process Manager initialize, can't full enable Headless mode.
    edward17 Newbie
    Currently Being Moderated
    Anyone gotten a JFXPanel to work on a Mac?
  • 2. Re: MacOS: Process Manager initialize, can't full enable Headless mode.
    jsmith Guru
    Currently Being Moderated
    [JSPAppKitAWT markAppIsDaemon]: Process manager already initialied: can't fully enable headless mode.
    The error message you mention is captured by this issue (scheduled for Lombard fix):

    http://javafx-jira.kenai.com/browse/RT-20784 "Headless environment issue, MacOSX"

    I don't know what the ramifications of the error message are, you could try asking on the issue comments if what the effect of it is and what workaround (if any) is needed or available.
    Anyone gotten a JFXPanel to work on a Mac?
    I haven't tried it.
  • 3. Re: MacOS: Process Manager initialize, can't full enable Headless mode.
    edward17 Newbie
    Currently Being Moderated
    Excellent reference, thank you.

    So JavaFX runs in headless mode on a Mac - period. for now.

    Are there ramifications for a new JFXPanel? Because I cannot seem to initialize one without getting the following:
    Exception in thread "AWT-EventQueue-0" java.awt.HeadlessException
         at java.awt.dnd.DropTarget.<init>(DropTarget.java:141)
         at java.awt.dnd.DropTarget.<init>(DropTarget.java:189)
         at javafx.embed.swing.SwingDnD.<init>(SwingDnD.java:127)
         at javafx.embed.swing.JFXPanel.<init>(JFXPanel.java:215)
         at org.ed4becky.evidentia.view.main.minieditor.MiniEditorController$1.run(MiniEditorController.java:51)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
         at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)
         at java.awt.EventQueue.access$200(EventQueue.java:103)
         at java.awt.EventQueue$3.run(EventQueue.java:682)
         at java.awt.EventQueue$3.run(EventQueue.java:680)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:691)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
  • 4. Re: MacOS: Process Manager initialize, can't full enable Headless mode.
    jsmith Guru
    Currently Being Moderated
    I got a Mac yesterday and tried this.

    The SwingInterop sample, which uses a JFXPanel, ran fine for me in desktop mode (it was kind of flaky and unreliable in the browser embedded applet mode).
    http://www.oracle.com/technetwork/java/javafx/samples/index.html
    Maybe download the source for that sample and try it out.

    (Safari 6.0.2 + OS X 10.8.2 + JDK1.7.0_09 + Macbook Air 13.3 mid 2012 + Intel HD4000).
  • 5. Re: MacOS: Process Manager initialize, can't full enable Headless mode.
    edward17 Newbie
    Currently Being Moderated
    OK, I can run a Swing App with a JFXPanel on a MAc. What I cannot seem to do is run a JavaFX App with an embedded Swing Component that uses a JFXPanel. Niether the JFrame nor the JFXPanel will initialize.

    The code below will not run (HeadlessException). However if I remove the "extend Application", delete start() and move the contents of start() to main(), it will run (no headless exception).

    What I am TRYING to do is create aan always on top window, which seems to require a JFrame right now, since JavaFX doesn't support it. Works fine on PC, only fails on the Mac (cause its headless?)

    Anyone think of a work around?

    Of course that does me no good.
    package javafxapplication1;
    
    import javafx.application.Application;
    import javafx.application.Platform;
    import javafx.embed.swing.JFXPanel;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.paint.Color;
    import javafx.scene.text.Text;
    import javafx.stage.Stage;
    import javax.swing.JFrame;
    import javax.swing.SwingUtilities;
    
    public class JavaFXApplication1 extends Application {
     private static void initAndShowGUI() {
            // This method is invoked on the EDT thread
            JFrame frame = new JFrame("Swing and JavaFX");
            final JFXPanel fxPanel = new JFXPanel();
            frame.add(fxPanel);
            frame.setSize(300, 200);
            frame.setVisible(true);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    
            Platform.runLater(new Runnable() {
                @Override
                public void run() {
                initFX(fxPanel);
                }
           });
        }
    
        private static void initFX(JFXPanel fxPanel) {
            // This method is invoked on the JavaFX thread
            Scene scene = createScene();
            fxPanel.setScene(scene);
        }
    
        private static Scene createScene() {
            Group  root  =  new  Group();
            Scene  scene  =  new  Scene(root, Color.ALICEBLUE);
            Text  text  =  new  Text();
            text.setX(40);
            text.setY(100);
            //text.setFont(new Font(25));
            text.setText("Welcome JavaFX!");
            root.getChildren().add(text);
            return (scene);
        }
    
        @Override
        public void start(Stage stage) throws Exception {
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                initAndShowGUI();
                }
            });
            
        }
    }
    Edited by: edward17 on Nov 28, 2012 4:52 AM
  • 6. Re: MacOS: Process Manager initialize, can't full enable Headless mode.
    edward17 Newbie
    Currently Being Moderated
    Any Oracle folk out there with MAC expertise?
  • 7. Re: MacOS: Process Manager initialize, can't full enable Headless mode.
    anouard Newbie
    Currently Being Moderated
    Hi,
    I get the same issue without JFXPanel, only by mixing JavaFX stage and a Swing JFrame creation.
    On my Mac, only the stage is displayed the Swing part generates the following stack trace. I also tried with the VM argument -Djava.awt.headless=false without any success.
    All is fine under Windows...
    Thanks for your help!

    2012-12-19 16:22:29.338 java[1189:2207] [JRSAppKitAWT markAppIsDaemon]:
    Process manager already initialized: can't fully enable headless mode.
    Exception in thread "AWT-EventQueue-0" java.awt.HeadlessException
         at 
    java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:207)
         at java.awt.Window.<init>(Window.java:535)
         at java.awt.Frame.<init>(Frame.java:420)
         at java.awt.Frame.<init>(Frame.java:385)
         at javax.swing.JFrame.<init>(JFrame.java:180)
         at 
    experiment.fx.JavaFXApplicationAndSwing$1.run(JavaFXApplicationAndSwing.jav
    a:23)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
         at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)
         at java.awt.EventQueue.access$200(EventQueue.java:103)
         at java.awt.EventQueue$3.run(EventQueue.java:682)
         at java.awt.EventQueue$3.run(EventQueue.java:680)
         at java.security.AccessController.doPrivileged(Native Method)
         at 
    java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.j
    ava:76)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:691)
         at 
    java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.jav
    a:244)
         at 
    java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:1
    63)
         at 
    java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.jav
    a:151)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
    Code:
    package experiment.fx;
    
    import javafx.application.Application;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.layout.StackPane;
    import javafx.stage.Stage;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.SwingUtilities;
    
    public class JavaFXApplicationAndSwing extends Application {
    
        @Override
        public void start(Stage primaryStage) {
    
            // Swing Part
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    JFrame jFrame = new JFrame();
                    jFrame.setBounds(10, 10, 320, 240);
                    jFrame.getContentPane().add(new JButton("I am a Swing Button!"));
                    jFrame.setVisible(true);
                }
            });
    
            // Back to JFX
            Button btn = new Button();
            btn.setText("Say 'Hello World'");
            btn.setOnAction(new EventHandler<ActionEvent>() {
                @Override
                public void handle(ActionEvent event) {
                    System.out.println("Hello World!");
                }
            });
    
            StackPane root = new StackPane();
            root.getChildren().add(btn);
    
            Scene scene = new Scene(root, 300, 250);
    
            primaryStage.setTitle("Hello World!");
            primaryStage.setScene(scene);
            primaryStage.show();
        }
        
        public static void main(String[] args) {
            launch(args);
        }
    }
  • 8. Re: MacOS: Process Manager initialize, can't full enable Headless mode.
    jsmith Guru
    Currently Being Moderated
    anouard,

    Does the SwingInterop sample work for you in desktop mode?
    http://www.oracle.com/technetwork/java/javafx/samples/index.html

    If not, it may be best to comment directly on the relevant issue:
    http://javafx-jira.kenai.com/browse/RT-20784

    You can link back to this forum question if you like.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points