Ihsane Bentahir
Ihsane Bentahir

Reputation: 21

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.

the commandline is like (under 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). 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).

under solaris i tried to use the command mode by running the program:

$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. at java.applet.Applet.(Applet.java:67) at javax.swing.JApplet.(JApplet.java:130) at .......

Note: I'm not interested in using GUI mode and wants to run only the applet in command mode. I'm working on Java 7.

Upvotes: 1

Views: 3133

Answers (1)

Ihsane Bentahir
Ihsane Bentahir

Reputation: 21

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

Exception in thread "main" java.awt.HeadlessException
at java.applet.Applet.<init>(Applet.java:67)
at javax.swing.JApplet.<init>(JApplet.java:130)
at ..

Upvotes: 1

Related Questions