0

I am really new to this and trying to get the JaamSim Tool running within Eclipse to run a Simulation for my Bachelors Thesis.

When ever I try to run the config im getting an libc++abi.dylib: terminating with uncaught exception of type NSException. The JaamSim Loading Window always opens for a brief moment and then closes again with the note "GUIFrame was unexpectedly closed"

I tried for days new and im out of ideas... installed the newest jdk from adoptopenjdk, as well as apache ant and maven. Also linked everything within the .bash_profile

I would be really grateful if somebody could guide me to an solution.I added the terminal log form eclipse here1

Btw I am on Mac if that helps

Elemental
  • 7,365
  • 2
  • 28
  • 33
MF1893
  • 13
  • 3

1 Answers1

0

The "exception" you are encountering is not a Java exception. It is a native Objective-C NSException. The "NS" stands for NeXTSTEP. It is a shibboleth of the old NeXTSTEP OS that is the ancestor of OS X and macOS. I can understand your confusion because both Objective-C and Java use the term "exception".

The logs you posted are, likewise, not a Java stack trace but an NSLog based thread dump from the native frameworks that your Java graphics depend on. You cut off the text of the actual exception in the image you linked. I'm guessing you didn't recognize the format and so didn't see the helpful message.

I'm going to guess that full text of the NSException message was "NSWindow drag regions should only be invalidated on the Main Thread!" If this is the case, then I think your problem is likely caused by changing some graphics from a background thread.

System graphics, such as windows, alerts, etc. are managed in macOS through a framework called "Cocoa". NSWindow is a Cocoa object. One of the important rules of Cocoa (and most UI frameworks) is that you should only alter Cocoa objects (like NSWindow) from the main thread. Probably, you are making some alterations to your GUI (specifically, invalidating drag regions) from a background thread. Java doesn't have any inherent problem with this, but Cocoa does. So you get a native error instead of a Java error.

TL;DR: Only work with your GUI from the main thread. You are getting this error because you are changing the GUI from a background thread.

EDIT: After doing a little research.

It appears that this particular issue occurs with certain Java OpenGL libraries, in particular lwjgl. You can see a very determined but ultimately fruitless effort to fix the problem here. I'm not sure what OpenGL Java interface is used in JaamSim, but they documented this same problem as far back as 2018, saying

The bug turns out to be a known problem with the JOGL software we use for 3d graphics. Unfortunately, it will take a while to get a fix in place.

The same JOGL bug was documented again in 2019. There, it seems to be resolved. Their report of the fix was

encapsulated both construction fully to run on the Main-Thread

I'm not sure how much control over this you have. Your best bet is to start by adding the -XstartOnFirstThread flag to your java command. I would also check if anyone in your class has been able to make this work on a Mac. Sometimes, it's nice to do a quick impossibility check before wasting time.

William Rosenbloom
  • 2,506
  • 1
  • 14
  • 37
  • thanks for the answer! The picture included everything from the eclipse terminal but you a crash report includes the 'NSWindow drag regions should only be invalidated on the Main Thread!' Is there anything I can do about that problem on my system site? Or is the problem caused by the code? Once again sorry for my noobish questions really lost atm... Maybe this picture of the crash report helps? https://i.stack.imgur.com/z3raT.png – MF1893 Nov 30 '20 at 16:07
  • @MF1893 I added what I could to the answer. I would highly recommend trying the `-XstartOnFirstThread` flag and also checking to see if anyone has made this work on a Mac. If it is a bug deep within JaamSim, then you might need to run it on another machine. – William Rosenbloom Nov 30 '20 at 17:03
  • Hey thanks again. I found the same JOGL Bug thing but sadly it did not help me. About the -XstartOnFirstThread am I understand correctly, that I should be adding it to the VM Arguments? Because if that is the case I guess that already happens with the tick that is preset https://i.stack.imgur.com/b9bgg.jpg – MF1893 Nov 30 '20 at 19:21
  • @MF1893 I guess then I would just make sure you are launching with SWT. I am pretty to curious to find out what the resolution is. So would appreciate if you post back here when you find one. – William Rosenbloom Nov 30 '20 at 19:28
  • I sadly did not find the problem so i switched to windows where it is running fine. Seems to be a Mac problem since it is not working out on Parallels either but on a clean windows Partion it does. However this might help in the future https://groups.google.com/g/jaamsim-users/c/JGqmj9CRXcU – MF1893 Dec 03 '20 at 13:48