Burp Suite User Forum

Create new post

Workaround for Java errors opening Burp on a secondary display on Linux

KoreLogic | Last updated: May 19, 2023 02:25AM UTC

I encountered this and worked through it before I could blame Burp, so I want to post about it here for search-engine happiness. Using openjdk-17 on Linux with multiple monitors, Burp will start just fine on the first monitor, :0 Starting Burp on a monitor other than the first one - so that DISPLAY is set to :0.1, :0.2, etc. - it would exit with no useful error message, just: Could not start Burp: java.lang.ExceptionInInitializerError There are lots of Burp forum threads about that error, but it's not detailed enough to get to the bottom of this. Testing with a Java app bundled with the jdk like jconsole: $ DISPLAY=:0.3 jconsole Exception in thread "main" java.lang.ExceptionInInitializerError at java.desktop/java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:106) at java.desktop/sun.awt.X11.XToolkit.<clinit>(XToolkit.java:224) at java.desktop/sun.awt.PlatformGraphicsInfo.createToolkit(PlatformGraphicsInfo.java:40) at java.desktop/java.awt.Toolkit.getDefaultToolkit(Toolkit.java:599) at java.desktop/javax.swing.UIManager.getSystemLookAndFeelClassName(UIManager.java:668) at jdk.jconsole/sun.tools.jconsole.JConsole.<clinit>(JConsole.java:60) Caused by: java.lang.NullPointerException: Cannot read the array length because "this.screens" is null at java.desktop/sun.awt.X11GraphicsEnvironment.initDevices(X11GraphicsEnvironment.java:235) at java.desktop/sun.awt.X11GraphicsEnvironment.rebuildDevices(X11GraphicsEnvironment.java:216) at java.desktop/sun.awt.X11GraphicsEnvironment.<init>(X11GraphicsEnvironment.java:201) at java.desktop/sun.awt.PlatformGraphicsInfo.createGE(PlatformGraphicsInfo.java:36) at java.desktop/java.awt.GraphicsEnvironment$LocalGE.createGE(GraphicsEnvironment.java:93) at java.desktop/java.awt.GraphicsEnvironment$LocalGE.<clinit>(GraphicsEnvironment.java:84) ... 6 more This '"this.screens" is null' is a bug in openjdk 17 <17.0.7, and I think would apply to any platform running Xwindows. If you encounter Burp startup errors when not on the first monitor, and can reproduce that 'Cannot read the array length because "this.screens" is null', see the following for a patch to openjdk that will fix the issue: https://bugs.gentoo.org/906708 https://bugs.openjdk.org/browse/JDK-8299417 https://git.openjdk.org/jdk17u-dev/commit/cec5a0ce48a898228b461809e004fec2559a4cad

Hannah, PortSwigger Agent | Last updated: May 19, 2023 09:03AM UTC

Thanks for posting this here! If there's anything we can help with, then please let us know.

You must be an existing, logged-in customer to reply to a thread. Please email us for additional support.