I am using IntelliJ IDEA for testing.
IntelliJ IDEA Version:
IntelliJ IDEA 2018.3.6 (Community Edition)
Build #IC-183.6156.11, built on March 25, 2019
JRE: 1.8.0_152-release-1343-b28 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 5.19.0-46-generic
I have added TestNG framework to IDE by adding the dependency in pom.xml file.
TestNG Dependency:<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.8.0</version>
<scope>test</scope>
</dependency>
Java version:openjdk version "11.0.19" 2023-04-18
OpenJDK Runtime Environment (build 11.0.19+7-post-Ubuntu-0ubuntu122.04.1)
OpenJDK 64-Bit Server VM (build 11.0.19+7-post-Ubuntu-0ubuntu122.04.1, mixed mode, sharing)
when i am running the code( in IntellijIDEA i am getting below error
Error:
Information:java: Errors occurred while compiling module 'FirstTest'
Information:javac 8 was used to compile java sources
Information:Module "FirstTest" was fully rebuilt due to project configuration/dependencies changes
Information:20/7/23 5:29 PM - Compilation completed with 1 error and 3 warnings in 1 s 350 ms
Warning:java: source value 1.5 is obsolete and will be removed in a future release
Warning:java: target value 1.5 is obsolete and will be removed in a future release
Warning:java: To suppress warnings about obsolete options, use -Xlint:-options.
/home/nxtwavetechhari/FirstTest/src/test/java/LoginPageTest.java
Error:(11, 30) java: cannot access org.testng.annotations.Test
bad class file: /home/nxtwavetechhari/.m2/repository/org/testng/testng/7.8.0/testng-7.8.0.jar(org/testng/annotations/Test.class)
class file has wrong version 55.0, should be 52.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
pom.xml file: <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="
http://maven.apache.org/POM/4.0.0"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>first-test</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.9.1</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.8.0</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
mvn version:Apache Maven 3.6.3
Maven home: /usr/share/maven
Java version: 11.0.19, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux", version: "5.19.0-46-generic", arch: "amd64", family: "unix"
May I know the reason behind this error? and please let me know the solution to this.
Thanks in advance