ClassNotFoundException with Jemmy Examples

421 Views Asked by At

I m trying to launch the jemmy examples from https://jemmy.java.net/tutorial.html and keep getting the ClassNotFoundExeption about the test- class, what is given in org.netbeans.jemmy.Test.main(String params). For example, with

enter code here



import org.netbeans.jemmy.*;
import org.netbeans.jemmy.explorer.*;
import org.netbeans.jemmy.operators.*;

public class WaitWindowSample implements Scenario {

    public int runIt(Object param) {
        try { //start application 
            new ClassReference("org.netbeans.jemmy.explorer.GUIBrowser").startApplication();
            //wait frame 
            new JFrameOperator("GUI Browser");
        } catch (Exception e) {
            e.printStackTrace();
            return (1);
        }
        return (0);
    }

    public static void main(String[] argv) {
        String[] params = {"WaitWindowSample"};
        org.netbeans.jemmy.Test.main(params);
    }
} 

i get:

> Class WaitWindowSample does not exist!
java.lang.ClassNotFoundException: WaitWindowSample
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

I have a normal Netbeans (ant) project and added jemmy2.jar to project libraries. What can be wrong?

1

There are 1 best solutions below

6
On

you should use classname with full package info. Try to use following code:

public static void main(String[] argv) {
    String[] params = {WaitWindowSample.class.getName()};
    org.netbeans.jemmy.Test.main(params);
}

I hope that it was worth to wait 9 months for this anwser :D