title: How to get monitor resolution and set it in DesktopLauncher config.width/height?
body: <p>Help, i'm trying to make resolution like in Terraria on PC, when it is fullscreen but still windowed. Why this code won't work?</p>
  
  <pre><code>package com.imaginegames.mmgame.desktop;
  
  import com.badlogic.gdx.Gdx;
  import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
  import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
  import com.imaginegames.mmgame.GameMain;
  
  public class DesktopLauncher {
      public static void main (String[] arg) {
          LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
          config.foregroundFPS = 60;
          config.title = "Millitary Madness";
          config.width = Gdx.graphics.getWidth();
          config.height = Gdx.graphics.getHeight();
          new LwjglApplication(new GameMain(), config);
      }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/AjbLF.png" rel="nofollow noreferrer">Screen</a></p>
  
  <p>It says:</p>
  
  <p>Exception in thread "main" java.lang.NullPointerException
      at com.imaginegames.mmgame.desktop.DesktopLauncher.main(DesktopLauncher.java:13)</p>