(Linux)如何在没有显示环境的情况下运行gtk程序? Gtk-WARNING **:无法打开显示: [英] (Linux) How to run a program of gtk without display environment? Gtk-WARNING **: cannot open display:

查看:718
本文介绍了(Linux)如何在没有显示环境的情况下运行gtk程序? Gtk-WARNING **:无法打开显示:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到了一个必须在GTK GUI环境中运行的程序。
我只能使用ssh。
这个程序将在服务器上运行(centos 6)并安装gnome X display。



无需查看GUI,但运行完成后,我可以得到答案。



VNC和远程屏幕禁用。



当我在ssh中启动程序时:



Gtk-WARNING **:无法打开显示:

有没有办法解决这个问题? ?
我知道在这种情况下运行gui程序是不好的,但在这里我们只讨论技术...



谢谢...

解决方案

ssh 工具有一个选项 -X ,它使X11转发。



您是否试图连接到您的目的地?



或者另一种选择是在您登录主机后执行 export DISPLAY =:0.0 然后运行你的应用。

通过这种方式,您可以节省一些网络流量,可远程运行您的应用程序,但GUI将显示在远程主机的屏幕上。 b
$ b

PS一般来说,如果运行 GUI 时应用程序逻辑可能无效。
您确定您的应用程序在无法运行GUI时会执行预期的工作吗?

I got a program which must run in GTK gui environment. I can only use ssh. This program will run on a server(centos 6) and installed gnome X display.

It's no need to see GUI, but after it run finished, i can get the answer.

VNC and Remote screen is disable.

When i start the program in ssh:

Gtk-WARNING **: cannot open display:

Is there any ways to salve this problem??? I known it's bad to run a gui program in this situation, but here we only discuss technology...

Thank you...

解决方案

The ssh utility has an option -X which enables X11 forwarding.

Have you tried to connect to your destination like that ?

Or the other option is to perform the export DISPLAY=:0.0 after you log-in to your host, then run your app.

This way you'll save some network traffic, will run your app remotely, but the GUI will be displayed on the screen of the remote host.

P.S. Generally speaking your application logic might be invalid if it fails to run GUI. Are you sure that your application will do the expected stuff when it fails to run the GUI ?

这篇关于(Linux)如何在没有显示环境的情况下运行gtk程序? Gtk-WARNING **:无法打开显示:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆