• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Display variable on unix

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

When I tried to run runme.jar file on unix , I am getting this exception


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:414)
at java.awt.Frame.<init>(Frame.java:403)
at javax.swing.JFrame.<init>(JFrame.java:207)
at suncertify.gui.MainWindow.<init>(MainWindow.java:110)
at suncertify.gui.ApplicationRunner.<init>(ApplicationRunner.java:75)
at suncertify.gui.ApplicationRunner.main(ApplicationRunner.java:49)


How to solve this , how to set display variable X11 DISPLAY on unix?


thanks
pramod
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm going to move this to the Unix / Linux forum, since this is only tangentially related to the SCJD assignment.

Are you working on the physical Unix machine? That is, can you confirm that you are not telnetting in, or otherwise connecting remotely?

Are you running a graphical user interface on the Unix system? Under Unix this should be the X11 Window System (often called X11 or X). Many Unix and (most) Linux systems have a desktop environment running on top of the X11 Window System - typically Gnome or KDE. Are any of these sounding familiar?

If the answers to both questions are yes (yes - you are running on the physical Unix system; and yes - you are running a graphical user interface), then you may be able to enter into your xTerm the command "export DISPLAY=:0.0" (without the quotes).

If you are not physically attached to the Unix system, then you will need to provide a little more information before we can provide any more help.

If you are not running a graphical user interface on the Unix system, then there are ways around it, but they may be more trouble than they are worth.

Finally - for the SCJD project, you don't really need to test under Unix systems (although I applaud you for trying). One option you might want to consider is getting a live CD so you can run Linux on your own personal computer without actually installing Linux. You could then use this for testing.

Regards, Andrew
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is most commonly seen when you have a web application that does graphics (such as charting) and you're running it on a server that isn't running a windowing system.

You can also encounter it if you attempt to run a Swing or AWT app on a command-line (non-windowed) machine.

DISPLAY is automatically set when you're running in a windowed session. You'd normally not change it.

For a webapp, there's an option to run "headless", but I don't have the documentation handy and I think it varies with whatever web application server you're using. Google will help - just look for "headless" and the name of your appserver (Tomcat or whatever).

For a standalone app, that's not going to work, since presumably the app depends on a GUI to work at all. In that case, you need to actually be running a windowing system. This might require installing the GUI and desktop packages, if they're not already installed.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your question leaves out some important details. Are you telnetting in, or ssh into the unix machine froma Windows machine? That seems like the most common things that people would do. If that is the case and assuming that your unix server is already running the X Server, you will need a X windows manager on your Windows machine. One free one is Xming that you can download off the net. You will need to just google for it. Then download putty to be used with Xming. You will need to enable the X11 forwarding in the connection properties of putty.

If you use some other ssh clients, you might have to set up the DISPLAY environments differently.
For c-shell, you would use something like:
setenv DISPLAY 192.168.2.4:0.0

for bash:
DISPLAY=192.168.2.4:0.0
export DISPLAY

Just remember to change the ip address to your unix machine.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic