installing MongoDB java driver installing MongoDB java driver mongodb mongodb

installing MongoDB java driver


First, that is not the correct jar. The jar you are referencing above contains the javadocs.

The driver jar is: mongo-java-driver-2.9.3.jar.

Secondly, you need to add the jar to your project's classpath in order to use it. These are not executable jars. Take a look at the getting started docs here:

http://docs.mongodb.org/ecosystem/tutorial/getting-started-with-java-driver/#getting-started-with-java-driver

There is no "installing" the driver. You just add it as a dependency in your project and you use it in your code. You do have to install the database itself. The installation packages for the database are available here: http://www.mongodb.org/downloads


Some jar files include an entry point and thus can be run by themselves, using a command like the one you tried.

Other jar files do not include an entry point; they are just libraries to be used by other Java classes. The MongoDB Java driver is like this. It's not designed to be used by itself.

If you are new to Java, you should probably spend some time learning Java before trying to use the Mongo Java driver. You might try http://docs.oracle.com/javase/tutorial/. You should probably at least get though the "Language Basics" section before trying to use MongoDB with Java.

If you want to use MongoDB by itself, you can use it with the Mongo shell.


This is how to use the 3.x monogo java driver. download the bson, monogodb driver core and mongodb driver.

add these jar files to CLASSPATH.

Or

Download the single file