If you are importing a JAR package, then the folder containing the .jar file has to be included in the CLASSPATH of your project. In this thread you can find instructions for setting a project classpath in Eclipse.
You should also consider using a package manager for managing dependencies, for example Maven. Eclipse provides great support for Maven, you can find details here. It is Ubuntu tutorial while you are probably using Windows, but everything important is the same here.
If you'll have any additional questions, comment this answer and I'll edit it accordingly.
In case you wanted to try Maven, I've attached an example of a pom.xml file - configuration file for Maven projects - that I use for running Selenuim tests. To run the tests using this setup, you need to go to the folder with the pom.xml file. In this folder run command mvn clean test
Before using the file, replace or remove:
com.example.your.domain as groupId
your-app-name as artifactId,
- the
<repositories> section (since I use a private repo for a few things)
- anything that doesn't fit you - notice that Java version is set to
1.8 and Selenium is managed by TestNG framework, which is executed by Surefire plugin, you don't need this setup.
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>4.0.0</modelVersion>
<groupId>com.example.your.domain</groupId>
<artifactId>your-app-name</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
<properties>
<property>
<name>reporter</name>
<value>listenReport.Reporter</value>
</property>
</properties>
</configuration>
</plugin>
</plugins>
</build>
<!-- <repositories>
<repository>
You might have to add a custom repo.
</repository>
</repositories>-->
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
</dependencies>
</project>