I have written unit tests for a Swing GUI that creates JFileChooser. Since the unit tests are run on a build server as a service, the unit tests need to run as the local sys
I believe is a Java 7 problem. Check your version and try with another. Or upgrade your java version.
I happened to have a very similar problem and I managed to solve it configuring the service to be executed with an admin account (in the config, not just starting it being an admin). Be aware that you will not be able to do this with an admin account that has no password (well, not without touching the registry).
This is not a JVM issue but a permissions issue. I recently encountered a similar stack trace running Java 8v92 on a Windows 10 machine.
To fix this, set the Windows Service to log on as an Administrator account (launch Services, highlight the service and show Properties, select Log On tab in Windows 10):