[英]Exception in thread “main” java.awt.HeadlessException: No X11 DISPLAY
I would like to run a java applet on Solaris that was in the past ran on Windows server. 我想在过去在Windows服务器上运行的Solaris上运行Java小程序。
the commandline is like (under windows): 命令行就像(在Windows下):
java.exe -cp file.jar xx.yy.applet param1 param2 param3
under Windows : 1) when this applet is executed following the above syntax, no GUI is displayed as the parameters are set in the command line (this is the command mode). 在Windows下:1)当按照上述语法执行此applet时,由于在命令行中设置了参数,因此不显示GUI(这是命令模式)。 2) if no parameter is given , then a GUI is displayed in the screen to allow the user to enter parameters manually (this is the GUI mode).
2)如果未提供任何参数,则屏幕上将显示一个GUI,以允许用户手动输入参数(这是GUI模式)。
under solaris i tried to use the command mode by running the program: 在solaris下,我尝试通过运行程序使用命令模式:
$JAVA_HOME/bin/java -cp file.jar xx.yy.applet param1 param2 param3
but the system throws the error : 但是系统抛出错误:
Exception in thread "main" java.awt.HeadlessException: No X11 DISPLAY variable was set, but this program performed an operation which requires it.
线程“主”中的异常java.awt.HeadlessException:没有设置X11 DISPLAY变量,但是该程序执行了需要它的操作。 at java.applet.Applet.(Applet.java:67) at javax.swing.JApplet.(JApplet.java:130) at .......
在java.applet.Applet(Applet.java:67)在javax.swing.JApplet(JApplet.java:130)在.......
Note: I'm not interested in using GUI mode and wants to run only the applet in command mode. 注意: 我对使用GUI模式不感兴趣,只想在命令模式下运行applet。 I'm working on Java 7.
我正在使用Java 7。
This is what I got when i add -Djava.awt.headless=true to the commmand line which becomes : $JAVA_HOME/bin/java -Djava.awt.headless=true -cp file.jar xx.yy.applet param1 param2 param3 这是我将-Djava.awt.headless = true添加到以下命令行时得到的结果:$ JAVA_HOME / bin / java -Djava.awt.headless = true -cp file.jar xx.yy.applet param1 param2 param3
Exception in thread "main" java.awt.HeadlessException
at java.applet.Applet.<init>(Applet.java:67)
at javax.swing.JApplet.<init>(JApplet.java:130)
at ..
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.