Java中的NoClassDefFoundError:com / google / common / base / Function
问题描述:
当我执行以下代码时:
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());
}
}
我遇到以下错误:
错误:[Ljava.lang.StackTraceElement; @ 80f4cb
error:[Ljava.lang.StackTraceElement;@80f4cb
线程中的异常main java.lang.NoClassDefFoundError:com / google / common / base / Function
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/base/Function
有人可以帮助我找到解决方案或原因?
Could someone help me to find the solution or reason for this?
答
我遇到了同样的问题,最后我发现我忘了添加 selenium-server-standalone-version.jar 。我只添加了客户端jar, selenium-java-version.jar 。
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.
希望这会有所帮助。