tradt / sikuli-api

Automatically exported from code.google.com/p/sikuli-api
0 stars 0 forks source link

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

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago

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");

        }
}

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

        sikuli main" java.lang.UnsatisfiedLinkError:

3. I added the Path and Sikuli_Home variable to my Eclipse Run configuration, 
after this the above error did not come.

4. 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 reported on code.google.com by dharmesh...@gmail.com on 30 Mar 2013 at 4:19