-2

I want to make a simple java application that can store strings and integers.

Now i have a working java application on my desktop computer that can store and retrieve stuff in a MySQL database

Now the problem is when i commit this project to git and then on my laptop I clone the project, i cant retrieve the information from the database

i get an error:

      java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

How do i fix this so i can retrieve the information i stored on my desktop. Thanks.

cmptUser
  • 51
  • 1
  • 10

2 Answers2

0

Did you share drive? If yes you need a different path on your laptop in order to see it from there.

  • how do i do that – cmptUser Oct 29 '17 at 20:34
  • Google is your friend :D Anyway you need to select path to your database on PC (IP + location), and then you should give it access to database, and that should work... (locally only if you wanna make it work online than you need to host your web online). Hope it helps I am still kinda new to programming thought – Ognjen Stanojevic Oct 29 '17 at 21:52
0

Have you tried mvn clean install ? Probably you are missing dependency. Add this to <dependencies> section in your projects pom.xml

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>6.0.6</version>
</dependency>
Serg.yer
  • 3
  • 3
  • im using intellij if that makes a difference but i dont see a pom.xml or even know what it is. another thing is i put the mysql-connector-java... in my external libraries. do i need to move that somewhere else? sorry im new to this stuff – cmptUser Oct 29 '17 at 20:56
  • To be really short maven is "dependency management tool" but as I understood you have created a simple project without using maven. – Serg.yer Oct 29 '17 at 21:24
  • So for your case try this way. Put the mysql-connector-java.jar into your projects out directory, there you will find your compiled class. e.g /out/production/untitled/Test.class , copy the mysql-connector-java.jar to this directory and open cmd, navigate to this directory and type this command: java -cp mysql-connector-java.jar; Test – Serg.yer Oct 29 '17 at 21:32