NoClassDefFoundError: org/openqa/selenium/WebDriver

2,940 views
Skip to first unread message

Snehal Biche

unread,
Apr 16, 2015, 10:11:34 AM4/16/15
to webd...@googlegroups.com
Need help to resolve issue.

when executing jar create out of below code, getting below error

Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriver

creating Jar out of below code and running on Linux system. In Eclipse Classpath I have tried adding all the jar files and also only "selenium-server-standalone-2.44.0.jar" 

demo.class 
===========================
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;




public class demo {

public static void main(String[] args) {
demo1 one = new demo1();
WebDriver ddriver = new FirefoxDriver();
one.login_web(ddriver, args[0], args[1], args[2]);

             ddriver.quit();
}

}

one.class 
==========================
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.support.ui.WebDriverWait;


public class one {

WebDriver ddriver = new FirefoxDriver();
//WebDriverWait waits = new WebDriverWait(ddriver, 30);
public boolean login_web(WebDriver driver, String address, String newpass) {

       // some code here
}

}


Rohit Patwari

unread,
Apr 17, 2015, 12:19:12 AM4/17/15
to webd...@googlegroups.com

This is basic java concept. You need to have your cide inside a static method.

--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webdriver+...@googlegroups.com.
To post to this group, send email to webd...@googlegroups.com.
Visit this group at http://groups.google.com/group/webdriver.
For more options, visit https://groups.google.com/d/optout.

darrell

unread,
Apr 17, 2015, 10:12:19 AM4/17/15
to webd...@googlegroups.com
I believe you need to add the files in the zip file to the classpath. Your code is client bindings and not server. So you get the ZIP file from Seelnium, unpack it and there will be jar files in the root plus a lib/ directory with more libraries you add to the class path. com.openqa.selenium.WebDriver is in those jar files.
Reply all
Reply to author
Forward
0 new messages