My question is: is there a way to set up a virtual display as default display on a linux server (so that all GUI application launched will be displayed on that display, if no counter indication is made)?
I tried using this: xvfb-run java -jar autoclick.jar
, which produces the following output :
searching graphic devices
is Headless:false
screen N°1 width:1600 height:900
just 1 robot click:
Magic button clicked !
and here's the autoclick code :
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();
}
To make it short, here are my 2 problems:
I still have to call xvfb-run every time i want to launch an application on the virtual display. Which means that applications that are not launched by me are not launched on the virtual display.
I can't launch another application on the display created by xvfb-run.
Sorry for my bad English syntax, and thank you for your time.
You can use the aforementioned apt-get command for installing any of the popular desktop environments. Installing more than one GUI is straightforward to install more than one GUI on the Ubuntu server. You can choose to switch between different GUIs by pressing the F1 key; doing that will toggle between GUI sessions.
Install Ubuntu Server GUI Step 1: Install Tasksel You have to choose whether to install GUI (graphical user interface) just using apt or apt-get... Step 2: Install Desktop Environment Once tasksel manager is installed, you can go ahead with the installation of one of... Step 3: Install multiple ...
Specify the resolution on a Ubuntu 14.04 desktop without a monitor connected: --fb widthxheight Reconfigures the screen to the specified size. All configured monitors must fit within this size.
However, if the VM’s display screen is tiny because it’s running an old OS, it can be advantageous to increase a window. Hit the “ Host key + C ” or from the View menu, choose the Scaled Mode option. To exit Scaled Mode, hit the “ Host key + C” combination once more.
Set up a virtual X server in the background with Xfvb, then set the DISPLAY variable accordingly:
Xvfb :1 -screen 0 1920x1080x24+32 -fbdir /var/tmp &
export DISPLAY=:1
java -jar autoclick.jar
java -jar autoclick.jar
java -jar autoclick.jar
(and again, and again, and again...)
Due to the DISPLAY variable, any application started in that terminal will use your virtual X server. I guess what xvfb-run does is set up a Xvfb, run the program, then immediately shuts down Xvfb again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With