We can simply import a jar file in eclipse performing a few steps. The following steps are given below:
In the first step, open your java project in eclipse IDE.
In the second step, select the project folder in which to add the jar file and then right click on the project folder(JavaDemo)->Build Path -> Configure Build Path.
In the third step, after clicking on Configure Build Path then a Properties for JavaDemo dialog box will appear. Click on Libraries tab -> select Modulepath -> click on Add External JARs -> select the required jar file -> open
In the fourth step, after clicking on Add External JARs and selecting the desired jar file and then clicking on the Apply and Close button.
Finally, we have added a jar file named “demo.jar” successfully after clicking on the Apply and Close button and to view in a project.