LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   *BSD (http://www.linuxquestions.org/questions/%2Absd-17/)
-   -   How to set X11 DISPLAY variable for an operation in program? (http://www.linuxquestions.org/questions/%2Absd-17/how-to-set-x11-display-variable-for-an-operation-in-program-618972/)

alan_ri 02-05-2008 10:25 PM

How to set X11 DISPLAY variable for an operation in program?
 
This is the output I get when I start Frostwire ( p2p program );

Code:

pcbsd# frostwire
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:317)
        at java.awt.Frame.<init>(Frame.java:419)
        at java.awt.Frame.<init>(Frame.java:384)
        at com.limegroup.gnutella.gui.AWTSplashWindow.splash(AWTSplashWindow.java:150)
        at com.limegroup.gnutella.gui.Main.showInitialSplash(Main.java:71)
        at com.limegroup.gnutella.gui.Main.main(Main.java:39)
pcbsd#


Matir 02-05-2008 10:57 PM

Don't try to run it as root.

jschiwal 02-05-2008 11:02 PM

You can put a definition before the command like:
DISPLAY=host:0.0 frostwire

For example, suppose that you ssh'ed into another computer with "ssh -X user@host". The DISPLAY variable should be ':10.0' which gets tunneled through ssh. If you had another session open on that host on display 'localhost:0.0', you could enter "DISPLAY=10.0 konsole &". The konsole program would pop up on the remote host.

You might want to investigate why the DISPLAY isn't variable set. How are you logged in?

alan_ri 02-06-2008 12:07 AM

I've run it as normal user ( thanks Matir ). It showed up, but it did not want to connect. Then I've changed the listening port, it connected. Then when I wanted to shut it down it restarted my PC.

Second time, when I've clicked on it, it just went to tray and KSysGuard doesn't list it in the process table.

What is going on here? :mad:

jschiwal 02-06-2008 12:42 AM

Right click on the icon in the system tray. There may be a quit context menu item. This is how some programs like Amarok and Ktorrent work as well. If you were downloading the latest disto's dvd via a torrent, you would close the main display after starting the download. The program will continue to operate in the background with an icon displayed in the tray. The program that you call may be a wrapper that calls another program and then quits. The process is a child that may have a different name and a different PID. Look at the output of "ps -u <username>" and see if it shows up there.

Sorry I missed that you were trying to launch it as root in your earlier message.

alan_ri 02-06-2008 09:23 AM

Third time; It didn't connect even if the listening port was the same as the last time. When I've changed it, it connected. I've tried to shut it down and again it restarted my PC.

I'm new to BSD, just few days trying it out, but this is weird. I did everything I should, I've even updated java with timezone update tracker.

I'm not able to give the output of the ps command at the moment. In the tray there is no quit button,only close, but nothing have happened when I've clicked on it. Why can I see it only as a normal user?

I did the same thing on Linux and there was no problem with X11 DISPLAY variable when I've run it as root. I will try the command you've suggested jschiwal ( DISPLAY=host:0.0 frostwire ) as soon as I can.

Thanks!


[EDIT]

I gave up.


All times are GMT -5. The time now is 09:43 PM.