Verification code does not display properly, suggesting Could not initialize class sun.awt.X11GraphicsEnvironment

Problems you may encounter when using this code in Web Development:
java.lang.NoClassDefFoundError: Could not the initialize class sun.awt.X11GraphicsEnvironment

Reason:
codes using awt graphics and memory generation, java program to find the graphical interface on the linux whether to start, such as linux missing components is, missing equipment, keyboard or mouse display may report this error;
it is necessary to open headless mode, Headless mode is a configuration mode of the system, begins to activate headless mode, tells the program, and now you want to work in Headless mode, do not expect the hardware to help, you have to self-reliance, the system relies on the computing power to simulate these characteristics carry on;

Adding JAVA_OPTS in tomcat / bin / catalina.sh in = "$ JAVA_OPTS -Djava.awt.headless = true

 

 
 

History article:
JAVA micro-channel enterprises to change payment (ten minutes to get)

Original link (my blog migration)  https://blog.csdn.net/angryjiji/article/details/98263244

Guess you like

Origin www.cnblogs.com/angryjj/p/11291982.html