wood burning stoves 2.0*
The moose likes Linux / UNIX and the fly likes when running swing program getting error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "when running swing program getting error" Watch "when running swing program getting error" New topic

when running swing program getting error

saravanan rajendran
Ranch Hand

Joined: Jun 13, 2008
Posts: 75
my code is this

Compiling: javac HelloWorldFrame.java
running:java HelloWorldFrame
when i running i getting below error i am new to this help me

Exception in thread "main" java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159)
at java.awt.Window.<init>(Window.java:407)
at java.awt.Frame.<init>(Frame.java:402)
at java.awt.Frame.<init>(Frame.java:367)
at javax.swing.JFrame.<init>(JFrame.java:163)
at HelloWorldFrame.<init>(HelloWorldFrame.java:11)
at HelloWorldFrame.main(HelloWorldFrame.java:9)

[edit]Add code tags CR[/edit]
[ July 07, 2008: Message edited by: Campbell Ritchie ]
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 37891
You ought to know how to add code tags by now.

Have you looked for HeadlessException in the Java API documentation? It tells you that you are short of a dependency (keyboard, screen or mouse) which is required to display your application. The message about X11 suggests you haven't got the screen configuration set up. Maybe your version of the OS runs only on a command-line.
It runs nicely on my PC without any changes.

You will probably get more appropriate help if I transfer you to a different forum . . .
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 37891
I don't think this is a Java-related problem, but to do with X11 settings.
Don't get me started about those stupid light bulbs.
subject: when running swing program getting error
Similar Threads
Error in NapKin Look and Feel
Getting error when running swing program
Can't connect to X11 window
Display variable on unix
Works on Windows and not Solaris, Why?