1

So i am having trouble with adding the mysql jar files in my classpath. here is a link to a more detailed version of my problem how to use database in java that will work on any computer

So these are the steps i took to add the jar file

  1. i went to https://dev.mysql.com/downloads/connector/j/5.1.html downloaded the mysql-connector-java-5.1.44-bin
  2. extracted it and saved it on my desktop

  3. went to intellij and did the following file-> project structure -> libraries -> clicked green plus sign and added the jar file heres a picture

enter image description here

  1. Then intellij creates a libraries folder with the mysql-connector-java-5.1.44-bin as an xml heres another pic

enter image description here

Thanks

cmptUser
  • 51
  • 1
  • 10

1 Answers1

2

You need only add jar(mysql) in libraries when click (+) You can run in IDE but when you build program to jar file, you must put jar(mysql) to your jar file. Go file-> project structure -> artifacts -> right click to jar(mysql) -> extract into output