I'm trying to make a connection between mongodb and java, but I get an error:
java.lang.NoClassDefFoundError: com/mongodb/MongoClient
I am aware this question is asked multiple times before but none of those i've tried works
1 adding to classpath (Also, in this post they are talking about server classpath. I don't know what that is, and if that is something I have to do on the server i'm running, that's not an option)
2 I have added the all jar files also needed (bson.jar, mongodb-driver-core-jar and mongodb-java.jar) All version 3.6.3
I have tried both methods in a maven project and a java project.
When opening the jar file after its exported, in its .classpath file the jar files for mongo are listed. How can i fix my problem?
PS: I notice that the jar file does not include dependency jar files. How would the jar file work on another system where files are not present? Also, not sure if it matters, but this is a plugin for a Minecraft Server
EDIT: Here's the pom.xml dependencies:
<dependencies>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver</artifactId>
<version>3.6.3</version>
</dependency>
</dependencies>
This should already include the bson and core jars, but doesnt work. I added them manually just in case. (Build Path -> Configure Build Path -> Add external jar) using Eclipse. I've added other jar files the same way and those do work, so I don't know why mongo won't