Adding a file .jar from the menu of Eclipse, File -> Properties -> Java Build Path -> Libraries -> Add External JARs…, causes an error, the project compiles but at runtime you get the error “NoClassDefFoundError” as if the file .jar was missing in the project.
To add correctly the file .jar:
- right click on the root of the project, New -> Folder, the directory name must be “libs”
- right click on the just created directory, Import -> General -> File System, and import the file .jar
- right click on the root of the project, Properties -> Java Build Path -> Libraries -> Add JARs…, (and not Add External JARs…), and select the file. jar from the libs directory
Leave a Reply