0

Facing 'Exception in thread "main" java.lang.NoClassDefFoundError"' exception in intellij

import org.testng.annotations.Test;

public class FistTestCase
{


    @Test
    void setup()
    {
        System.out.println("Open browser");
    }
    @Test
    void login()
    {
        System.out.println("This is login test");
    }

    @Test
    void teardown()
    {
        System.out.println("Close browser");
    }


}
Gautham M
  • 4,816
  • 3
  • 15
  • 37

1 Answers1

0

Whenever you compile your code, you end up with .class file extension for every class that is required in that program. These .class files are binary files of the actual classes. The Noclassfounddef error arrives when the class loader isn't able to find the package in your main directory. So this means, that the classpath doesn't include all the required packages to run the code. Just check out whether this file is at a correct directory ideally somewhere around main class or in a subdirectory.

Muhammad Ahmed
  • 318
  • 2
  • 8