7

I new in Eclipse,Java and Linux. I search about this issue but I don't reach to answer. I want to write a program that manipulate HBase Tables. So I have some Jar files that they related to the HBase. In ordinary Java application I add Jar files through following instruction

Build Path -> Configuration Build Path -> Add External Jars

So in Dynamic Web Project sound like different. after some search I understand the Jar files must be added in WEB-INF/lib or in %TOMCAT_HOME%/lib. so I get answer from %TOMCAT_HOME%/lib but really stuck about how to add jar files in WEB-INF/lib. I copy all jar files in the folders but it doesn't work.

please help me in detail.

Mahdi
  • 1,777
  • 4
  • 24
  • 48

6 Answers6

12

you are doing right....

Build Path -> Configuration Build Path -> Add External Jars

In "Order and Export" tab click on select all...

or coping file into WEB-INF/lib 

Then just refresh your project and restart the server then deploy the project it will work fine...

Nirav Valera
  • 420
  • 4
  • 13
  • according to first it will give an exception at run time – Achyut Oct 09 '13 at 11:48
  • I know this is from a while ago, but is there any reason that copying jars into WEB-INF/lib would **not** work? I'm running into an issue where the jars are available on the filesystem, but not visible in eclipse. – drognisep Nov 21 '16 at 20:44
1

To add jars in eclipse you have two options:

  1. Right click on project got to properties-->click on java build path --> configure build path--> Libraries --> and select add external jars button. It will open a window where you can add all your jars required.
  2. Second option is to paste jars directly to lib folder. lib folder is in Web Content --> WEB-INF --> lib.

Use any one of them.

1

as Cultor said its right process but you must be refresh project after adding jar files.

Build Path -> Configuration Build Path -> Add External Jars

Vinay
  • 347
  • 1
  • 7
  • 16
0

You can drag the MySQL jar file from external folder where it is located in your computer into the lib of your project..

Matt
  • 74,352
  • 26
  • 153
  • 180
0

If a path to the jar file is too long it will not paste that jar file.

Paste the jar file on the desktop and try again.

This works for me.

0

You can copy jar files manually to WEB-INF/lib when you have your project open in eclipse, then while modifying build path, just click "add jars" button and refer a jar from WEB-INF/lib . By this when you deploy your project to tomcat, your WEB-INF/lib folder gets copied automatically.

Rahul Borkar
  • 2,742
  • 3
  • 24
  • 38