Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Mac OS X issue with jsfml.rar  (Read 1878 times)

0 Members and 1 Guest are viewing this topic.

roxyavgfli

  • Newbie
  • *
  • Posts: 3
    • View Profile
Mac OS X issue with jsfml.rar
« on: June 07, 2015, 03:21:50 pm »
Hi guys, I'm new to this forum,

I have a terrible issue with an application that i am developing with collaborators. It seems to run well on linux but I do get this message with mac OS X, and I couldn't figure it out yet.

Exception in thread "AWT-EventQueue-0" org.jsfml.internal.JSFMLError: This thread is not allowed to create a window on this system. If you are running on Mac OS X, you MUST run your application with the -XstartOnFirstThread command line argument!
        at org.jsfml.window.Window.create(Unknown Source)
        at org.jsfml.graphics.RenderWindow.create(Unknown Source)
        at org.jsfml.graphics.RenderWindow.<init>(Unknown Source)
        at grahique.Jeu.<clinit>(Jeu.java:25)
        at grahique.SelectLevel.actionPerformed(SelectLevel.java:113)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)

Anyone of you does have an idea?

SpeCter

  • Full Member
  • ***
  • Posts: 151
    • View Profile
Re: Mac OS X issue with jsfml.rar
« Reply #1 on: June 07, 2015, 03:24:50 pm »
Exception in thread "AWT-EventQueue-0" org.jsfml.internal.JSFMLError: This thread is not allowed to create a window on this system. If you are running on Mac OS X, you MUST run your application with the -XstartOnFirstThread command line argument!
        at org.jsfml.window.Window.create(Unknown Source)
        at org.jsfml.graphics.RenderWindow.create(Unknown Source)
        at org.jsfml.graphics.RenderWindow.<init>(Unknown Source)
        at grahique.Jeu.<clinit>(Jeu.java:25)
        at grahique.SelectLevel.actionPerformed(SelectLevel.java:113)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)

Anyone of you does have an idea?

You did try:
Quote
If you are running on Mac OS X, you MUST run your application with the -XstartOnFirstThread command line argument.

Right?

roxyavgfli

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Mac OS X issue with jsfml.rar
« Reply #2 on: June 08, 2015, 12:40:23 am »
Hi man thanks for replying,

Yes I did try it! Doing this allowed me to get rid off this error, but graphical doesn't want to appear.
I made quite a few researches this week end and did not found anything about this precise issue.


Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Mac OS X issue with jsfml.rar
« Reply #3 on: June 08, 2015, 08:37:32 am »
If you want some help, give us a http://sscce.org/ .
SFML / OS X developer

roxyavgfli

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Mac OS X issue with jsfml.rar
« Reply #4 on: June 08, 2015, 05:43:15 pm »
it's fine, finally found what was wrong.
Seems like
EventQueue.invokeLater(new Runnable() {
                        @Override
                        public void run() {
                                try {
                                        Game game = new Game(0);
                                } catch (Exception e) {
                                        e.printStackTrace();
                                }
                        }
                });
doesn't work on Mac os X but
Game game = new Game();
is working fine

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Mac OS X issue with jsfml.rar
« Reply #5 on: June 09, 2015, 03:19:05 pm »
On OS X, windows and events must be managed in the main thread

Yep, that's true. Mac OS X just won't agree if you try to create a window or handle events in a thread other than the main one.
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

 

anything