Target VM failed to initialize on Mac

Hello all,

I know there have been discussions about this issue in the past, but most of the solutions I can find online are dealing with Windows computers with Nvidia graphics cards. I am on a MacBook Pro, running OSX 10.13.6 (High Sierra), with an Intel Iris Plus Graphics 650 1536 MB graphics card.

Any time I try to run my sketch, it will open and work for a few moments, and then crash unexpectedly and show the following error message:

A fatal error has been detected by the Java Runtime Environment:

SIGSEGV (0xb) at pc=0x00007fff36b2285e, pid=904, tid=0x000000000000e6b3

JRE version: Java™ SE Runtime Environment (8.0_202-b08) (build 1.8.0_202-b08)

Java VM: Java HotSpot™ 64-Bit Server VM (25.202-b08 mixed mode bsd-amd64 compressed oops)

Problematic frame:

C [libGL.dylib+0x185e] glEnable+0xf

Failed to write core dump. Core dumps have been disabled. To enable core dumping, try “ulimit -c unlimited” before starting Java again

An error report file with more information is saved as:

/Users/benvining/hs_err_pid904.log

Compiled method (nm) 6044 1434 n 0 jogamp.opengl.gl4.GL4bcImpl::dispatch_glEnable1 (native)
total in heap [0x00000001153bf710,0x00000001153bfa38] = 808
relocation [0x00000001153bf838,0x00000001153bf878] = 64
main code [0x00000001153bf880,0x00000001153bfa30] = 432
oops [0x00000001153bfa30,0x00000001153bfa38] = 8

If you would like to submit a bug report, please visit:

http://bugreport.java.com/bugreport/crash.jsp

The crash happened outside the Java Virtual Machine in native code.

See problematic frame for where to report the bug.

Could not run the sketch (Target VM failed to initialize).
For more information, read revisions.txt and Help → Troubleshooting.
Copied to the clipboard. Use shift-click to search the web instead.

OK, so I saw someone suggest somewhere that this problem could be caused by fonts loading incorrectly. I tried replacing all my fonts with a createFont() instead of a loadFont() and the sketch didn’t crash.
I re examined the text I was printing using println() and discovered that for a couple of the things which I allow the user to rename dynamically in the GUI, for some reason there’s a mystery character inserted at the beginning of the string:
This is the code I’m using in my keypressed() to allow the user to edit their username while the sketch is running – is there something I’ve goofed that’s adding a weird character to the beginning of the string?
void keyPressed() {
if (editingPlayerName == true) {
if (key == ‘\n’) {
playerName = typingPlayerName;
typingPlayerName = “”;
profileScreen = 0;
drawPlayerProfileScreen();
updatePlayerName();
} else if (key == BACKSPACE) {
typingPlayerName = typingPlayerName.substring(0, max(0, typingPlayerName.length() - 1));
} else {
typingPlayerName = typingPlayerName + key;
}
}