RACING121 RACING121 - 5 months ago 11x
Java Question

How to show dialog when lwjgl game crashes (java)

I am using LWJGL to make my new game.

Quick Question:

When my game crashes with something like this:

Exception in thread "main" java.lang.NullPointerException
at engineTester.MainGameLoop.main(
C:\Users\Kojo Ofori\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:53: Java returned: 1

How do I get it to print it in dialog so that when someone runs it and it crashes they will be able to see it as a dialog that is has crashed

Hope it made sense


You can use try ...catch and catch the exception (in a baseclass / superclass), send the user an error code that he can report and log a more detailed error. Depending on your configuration:

    try {
        /* game is playing() */
    catch (MyGameException gameException) {