The easiest way I can think of obtaining a set of dependencies would be to create a new Maven project and add each of the jars you require to the project pom file.
Maven, if you're not aware is a Java build tool that focuses on making dependency management easy. It does so through a pom.xml file which lists information about your project including the list of jars (dependencies) that it requires. Dependencies are identified by their name (artifactId), group and version in the following XML format...
<dependency>
<groupId>group-a</groupId>
<artifactId>artifact-b</artifactId>
<version>1.0</version>
</dependency>
You could create a new mvn project (download and install maven first) then execute:
mvn archetype:generate
To create a new project. This will provide you with an empty project with no dependencies and a template pom.xml file. From there you can edit your dependency list and add each of the 40 jars you require. Once you've done that execute ...
mvn dependency:copy-dependencies
This will pull all of the jar files you require from the Maven online central repoistory into your project's target/dependency folder. From there you can write a script to perform the md5sum comparison of your jar files.
Find out more about Maven at the official homepage.