0

I am trying to do this: http://www.softwareishard.com/blog/firebug/automate-page-load-performance-testing-with-firebug-and-selenium/

Below is the screenshot taken from eclipse

package com.stack.tests;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;

public class PerformanceTesting {
       public static void main(String[] args) {
            FirefoxProfile profile = new FirefoxProfile();
            WebDriver driver = new FirefoxDriver(profile);
            driver.quit();
        } }

Below is the error code taken while running:

E:\stackoverflow\src\test\java\com\stack\tests>javac -cp selenium-serv
er-standalone-2.52.0.jar PerformanceTesting.java

E:\stackoverflow\src\test\java\com\stack\tests>set classpath=%classpat
h%;.;

E:\stackoverflow\src\test\java\com\stack\tests>java -cp .;selenium-ser
ver-standalone-2.52.0.jar PerformanceTesting
Exception in thread "main" java.lang.NoClassDefFoundError: PerformanceTesting (w
rong name: com/stack/tests/PerformanceTesting)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        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)
        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)

Does somebody know how to fix it?

  • I see com.stackovfl.tests in the eclipse excerpt and com/stack/tests in the error code. Might that be part of the problem? – user246 Mar 2 '16 at 21:26
  • I changed it. I added wrongly. It was my company name so changed it to stack overflow. – Deepak Nath Mar 3 '16 at 3:33
  • 1
    Have you added the Selenium Standalone JAR file to your JAVA project? – IAmMilinPatel Sep 6 '16 at 3:37
7

Have you added the Selenium Standalone JAR to your Java Project in Eclipse?

In Eclipse,

  • Expand your project
  • Right click on Referenced Libraries.
  • Point to Build Path
  • Select Configure Build Path
  • In the dialog box that appears remove any old libraries, add new ones and check and make sure you have added Selenium JAR.

Once you have added the required libraries to the project try running again. It should solve the problem.

1

This exception is occur only when selenium-server-standalone-2.52.0.jar is not added or the path is not correct. Please add selenium-server-standalone-2.52.0.jar again or set your path again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.