【发布时间】:2016-08-03 14:47:17
【问题描述】:
我的问题是:有没有办法将虚拟显示器设置为 linux 服务器上的默认显示器(如果没有计数器指示,所有启动的 GUI 应用程序都将显示在该显示器上)?
我尝试使用这个:xvfb-run java -jar autoclick.jar,它会产生以下输出:
searching graphic devices
is Headless:false
screen N°1 width:1600 height:900
just 1 robot click:
Magic button clicked !
这是自动点击代码:
System.out.println("searching graphic devices");
System.out.println("is Headless:"+GraphicsEnvironment.isHeadless());
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
int count = 1;
for(GraphicsDevice screen : ge.getScreenDevices())
{
System.out.println("screen N°"+count+" width:"+screen.getDisplayMode().getWidth()
+" height:"+screen.getDisplayMode().getHeight());
}
{... create a JFrame and add a JButton that closes the application and prints a message to the console when clicked}
System.out.println("just 1 robot click:");
try
{
robot = new Robot();
justOneClick(frame.getX()+100, frame.getY()+100);
}
catch(AWTException e)
{
e.printStackTrace();
}
简而言之,这是我的两个问题:
每次我想在虚拟显示器上启动应用程序时,我仍然必须调用 xvfb-run。这意味着不是我启动的应用程序不会在虚拟显示器上启动。
我无法在 xvfb-run 创建的显示器上启动另一个应用程序。
抱歉我的英语语法不好,感谢您的宝贵时间。
【问题讨论】:
标签: virtual x11 ubuntu-server