3.2.2 X using maven10macOSglfwJava code:
import static org.lwjgl.glfw.GLFW.*;
import static org.lwjgl.system.MemoryUtil.*;
public class Main {
public static void main(String[] args) {
if (!glfwInit())
throw new IllegalStateException("Unable to initialize GLFW");
// Configure GLFW
glfwDefaultWindowHints(); // optional, the current window hints are already the default
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); // the window will stay hidden after creation
glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE); // the window will be resizable
long window = glfwCreateWindow(300, 300, "Hello World!", NULL, NULL);
if ( window == NULL )
throw new RuntimeException("Failed to create the GLFW window");
}
}
Output:
/Library/Java/JavaVirtualMachines/jdk-10.0.2.jdk/Contents/Home/bin/java "-javaagent:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar=53261:/Applications/IntelliJ IDEA CE.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath /Users/Tnze/Documents/projects/java/ShootingGame/target/classes:/Users/Tnze/.m2/repository/org/lwjgl/lwjgl/3.2.2/lwjgl-3.2.2.jar:/Users/Tnze/.m2/repository/org/lwjgl/lwjgl-assimp/3.2.2/lwjgl-assimp-3.2.2.jar:/Users/Tnze/.m2/repository/org/lwjgl/lwjgl-glfw/3.2.2/lwjgl-glfw-3.2.2.jar:/Users/Tnze/.m2/repository/org/lwjgl/lwjgl-openal/3.2.2/lwjgl-openal-3.2.2.jar:/Users/Tnze/.m2/repository/org/lwjgl/lwjgl-opengl/3.2.2/lwjgl-opengl-3.2.2.jar:/Users/Tnze/.m2/repository/org/lwjgl/lwjgl-stb/3.2.2/lwjgl-stb-3.2.2.jar:/Users/Tnze/.m2/repository/org/lwjgl/lwjgl/3.2.2/lwjgl-3.2.2-natives-macos.jar:/Users/Tnze/.m2/repository/org/lwjgl/lwjgl-assimp/3.2.2/lwjgl-assimp-3.2.2-natives-macos.jar:/Users/Tnze/.m2/repository/org/lwjgl/lwjgl-glfw/3.2.2/lwjgl-glfw-3.2.2-natives-macos.jar:/Users/Tnze/.m2/repository/org/lwjgl/lwjgl-openal/3.2.2/lwjgl-openal-3.2.2-natives-macos.jar:/Users/Tnze/.m2/repository/org/lwjgl/lwjgl-opengl/3.2.2/lwjgl-opengl-3.2.2-natives-macos.jar:/Users/Tnze/.m2/repository/org/lwjgl/lwjgl-stb/3.2.2/lwjgl-stb-3.2.2-natives-macos.jar online.jdao.java.Main
2019-05-21 21:44:28.935 java[2459:143151] WARNING: nextEventMatchingMask should only be called from the Main Thread! This will throw an exception in the future.
2019-05-21 21:44:28.935 java[2459:143151] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], /BuildRoot/Library/Caches/com.apple.xbs/Sources/Foundation/Foundation-1575.12/Foundation/Misc.subproj/NSUndoManager.m:361
2019-05-21 21:44:28.935 java[2459:143151] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], /BuildRoot/Library/Caches/com.apple.xbs/Sources/Foundation/Foundation-1575.12/Foundation/Misc.subproj/NSUndoManager.m:361
2019-05-21 21:44:28.937 java[2459:143151] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff3b44dcfd __exceptionPreprocess + 256
1 libobjc.A.dylib 0x00007fff65af7a17 objc_exception_throw + 48
2 CoreFoundation 0x00007fff3b468a1a +[NSException raise:format:arguments:] + 98
3 Foundation 0x00007fff3d707c85 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 194
4 Foundation 0x00007fff3d63acfa +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 473
5 AppKit 0x00007fff38a15915 -[NSApplication run] + 916
6 libglfw.dylib 0x000000010e7139d5 libglfw.dylib + 68053
7 libglfw.dylib 0x000000010e70d366 libglfw.dylib + 41830
8 ??? 0x000000011a901b50 0x0 + 4740619088
9 ??? 0x000000011a8fba50 0x0 + 4740594256
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Process finished with exit code 134 (interrupted by signal 6: SIGABRT)
The system version is macOS Mojave 10.14.5 (18F132)
solved by add -XstartOnFirstThread
Most helpful comment
solved by add
-XstartOnFirstThread