Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

installing MongoDB java driver

I'm really new in Java and also MongoDB world. I would like to use MongoDB and Java. I have downloaded MongoDB driver for java. It is a jar file, my question is how can I use this Jar file. I've used this command but I got an error:

java -jar mongo-java-driver-2.9.3-javadoc.jar 

and the error:

no main manifest attribute, in mongo-java-driver-2.9.3-javadoc.jar

could you please help me to solve the problem?

like image 216
TangoStar Avatar asked Jun 20 '13 15:06

TangoStar


People also ask

What is the MongoDB driver?

The official MongoDB Node. js driver allows Node. js applications to connect to MongoDB and work with data. The driver features an asynchronous API which allows you to interact with MongoDB using Promises or via traditional callbacks.

Can I connect MongoDB with Java?

Before you start using MongoDB in your Java programs, you need to make sure that you have MongoDB CLIENT and Java set up on the machine. You can check Java tutorial for Java installation on your machine. Now, let us check how to set up MongoDB CLIENT. You need to download the jar mongodb-driver-3.11.

What is MongoDB synchronous driver?

The MongoDB Driver mongodb-driver-sync is the synchronous Java driver containing only the generic MongoCollection interface that complies with a new cross-driver CRUD specification. It does not include the legacy API (e.g. DBCollection ).


1 Answers

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

like image 76
gregwhitaker Avatar answered Sep 30 '22 19:09

gregwhitaker