Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"No X11 DISPLAY variable was set" error came on Linux using Sikuli Stand Alone api #41

Open
doubleshow opened this issue Jun 13, 2013 · 1 comment

Comments

@doubleshow
Copy link
Member

Original author: [email protected] (March 30, 2013 16:19:18)

What steps will reproduce the problem?

  1. I Created a sample script like one below on my GNU/Linux machine using the Eclipse IDE. I added the sikuli standalone .jar.

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;

import javax.swing.plaf.basic.BasicSplitPaneUI.KeyboardEndHandler;

import org.sikuli.api.*;
import org.sikuli.api.robot.Keyboard;
import org.sikuli.api.robot.Mouse;
import org.sikuli.api.robot.desktop.DesktopKeyboard;
import org.sikuli.api.robot.desktop.DesktopMouse;
import org.sikuli.api.visual.Canvas;
import org.sikuli.api.visual.DesktopCanvas;

import static org.sikuli.api.API.*;

public class FirstStandAlone
{

    public static void main(String[] args) throws MalformedURLException, InterruptedException 
    {           

            // Open the main page of Google Code in the default web browser
            browse(new URL("MYAPP"));


            // Create a screen region object that corresponds to the default monitor in full screen 
            ScreenRegion s = new DesktopScreenRegion();
            System.out.println("jiuiuiuddfcscdesi");

            ScreenRegion result = s.wait(new ImageTarget(new File("//home//dgangwar/LoginFields.PNG")), 5000);
    System.out.println(null==result);
    System.out.println("jiuiuiui");

// //Target imageTarget = new ImageTarget(new File(DataFile.USERIDTEXT));
Mouse mouse = new DesktopMouse();
mouse.click(result.getCenter());

    Mouse mouse = new DesktopMouse();
            mouse.click(result.getCenter());
            Keyboard kb = new DesktopKeyboard();
            kb.type("Hijhiih");

    }

}

  1. After running this program I got the below error.

    sikuli main" java.lang.UnsatisfiedLinkError:
    
  2. I added the Path and Sikuli_Home variable to my Eclipse Run configuration, after this the above error did not come.

  3. Now I ran the Test case and got the below error. I have set up my VNC with 3 screen resolutions.

    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.Desktop.getDesktop(Desktop.java:142)
    at org.sikuli.api.API.browse(API.java:20)
    at FirstStandAlone.main(FirstStandAlone.java:18)

What is the expected output? What do you see instead?

I used the same code on windows and it worked fine but on Linux I had the above problem.

What version of the product are you using? On what operating system?

GNU/LINUX , Sikuli-api-1.0.2-standalone.jar, Java SE 6

Please provide any additional information below.

Original issue: http://code.google.com/p/sikuli-api/issues/detail?id=41

@vinogradoff
Copy link

Have you tried to set DISPLAY variable?

export DISPLAY=localhost:0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants