Q: When I’m installing PDF Studio as root, there’s an error message “Could not initialize class sun.awt.X11GraphicsEnvironment”. How can I solve this issue?

A: On some Linux distros such as CentOS,  the user environment variables including the display may not be passed to root.

The error message you will see in the console is the following:


[root]# sh ./PDFStudio_linux64.sh
Unpacking JRE ...
Starting Installer ...
No protocol specified
An error occurred:
java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment
Error log: /tmp/install4jError4707774229996912612.log
java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:103)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:82)
at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:132)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at java.awt.Toolkit$2.run(Toolkit.java:860)

You can use the following workarounds:

  • Run the installer in console mode
    • On Terminal, enter sh ./PDFStudio_linux64.sh -q -console -splash
  • Make sure root user inherits the user display
    • On Terminal, enter su –
    • install PDF Studio with this command: sh ./PDFStudio_linux64.sh
  • Switch to a non-root user and install again
    • On Terminal, enter su [username]
    • install PDF Studio with this command: sh ./PDFStudio_linux64.sh

Note: PDF Studio is a GUI application and will need a GUI / display environment to be launched after it’s installed.