1

I'm learning selenium and I just copied a simple java code from a website and tried to run it. But it gave me the below error. Please help me in fixing it.

Installed files:

 1. Selenium api 2.44.0
 2. Selenium firefox driver 2.44.0
 3. Seleinium server stand alone 2.53.1
 4. Selenium support 2.44
 5. Firefox version - 35.1.0

Error:

Exception in thread "main" java.lang.NoClassDefFoundError:
org/openqa/selenium/remote/internal/CircularOutputStream at org.openqa.selenium.firefox.FirefoxBinary.(FirefoxBinary.java:59) at org.openqa.selenium.firefox.FirefoxBinary.(FirefoxBinary.java:55) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:95) at Sel.OpenGoogle.main(OpenGoogle.java:6) Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.remote.internal.CircularOutputStream at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 4 more

My code:

package Sel;
import org.openqa.selenium.WebDriver;  
import org.openqa.selenium.firefox.FirefoxDriver;  
public class OpenGoogle {  
  public static void main(String args[]){  
  WebDriver driver=new FirefoxDriver();  
  System.out.println("Hello Google...");  
  driver.get("http://google.com");    
    }  
 } 

Error after adding selenium remote driver 2.4.4

Exception in thread "main" org.openqa.selenium.WebDriverException: Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: VISTA
Build info: version: '2.44.0', revision: '76d78cf323ce037c5f92db6c1bba601c2ac43ad8', time: '2014-10-23 13:11:40'
System info: host: 'PC', ip: '192.168.1.2', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_101'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.firefox.internal.Executable.<init>(Executable.java:72)
at org.openqa.selenium.firefox.FirefoxBinary.<init>(FirefoxBinary.java:59)
at org.openqa.selenium.firefox.FirefoxBinary.<init>(FirefoxBinary.java:55)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:95)
at Sel.OpenGoogle.main(OpenGoogle.java:6)
8

2 Answers 2

0

@Stack Mark Download selenium 2.53 for java from this link

http://selenium-release.storage.googleapis.com/index.html?path=2.53/

Delete all the currently installed jar files and load the new ones. Be careful not to delete JRE system library. Then everything will work fine. By the way which firefox browser are you using? I am using 47.0.1 Benefit is you don't have to use gecko driver.

Sign up to request clarification or add additional context in comments.

1 Comment

I got this error when i followed ur steps and I use 35.0.1 `Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/base/Function at Sel.OpenGoogle.main(OpenGoogle.java:7) Caused by: java.lang.ClassNotFoundException: com.google.common.base.Function at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 1 more'
0

OpenGoogle.java

Your code works fine on my system. You better check the classpath for jdk. Hope this helps. :) Apart from that check these out. http://www.codegravity.com/blog/exception-in-thread-main-java-lang-noclassdeffounderror

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.