When I executing the following code:
public static void main(String[] args) { try { FirefoxDriver driver = new FirefoxDriver(); driver.get("http:www.yahoo.com"); } catch (NoClassDefFoundError ex) { System.out.println("error: " + ex.getStackTrace()); } }
I'm facing the following error:
error:[Ljava.lang.StackTraceElement;@80f4cb
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/base/Function
Could someone help me to find the solution or reason for this?
lang. NoClassDefFoundError, which means the Class Loader file responsible for dynamically loading classes can not find the . class file. So to remove this error, you should set your classpath to the location where your Class Loader is present.
java. lang. NoClassDefFoundError is runtime error thrown when a required class is not found in the classpath and hence JVM is unable to load it into memory.
I had the same problem, and finally I found that I forgot to add the selenium-server-standalone-version.jar. I had only added the client jar, selenium-java-version.jar.
Hope this helps.
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