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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "when running swing program getting error" Watch "when running swing program getting error" New topic
Author

when running swing program getting error

saravanan rajendran
Ranch Hand

Joined: Jun 13, 2008
Posts: 75
hi,
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
Sheriff

Joined: Oct 13, 2005
Posts: 38075
    
  22
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
Sheriff

Joined: Oct 13, 2005
Posts: 38075
    
  22
I don't think this is a Java-related problem, but to do with X11 settings.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: when running swing program getting error
 
Similar Threads
Error in NapKin Look and Feel
Display variable on unix
Getting error when running swing program
Can't connect to X11 window
Works on Windows and not Solaris, Why?