0

I completed my very first project and i export it to a jar file. After that i made a text document and convert it into a bat file

Inside of the text document i put this

java -jar MyProject.jar

pause

but after executing the bat file i encountered an error

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

So im currently stuck in the Login page. I feel like im missing something, what is it?

My program is running fine in my Eclipse IDE and its connected to the database successfully, but when i click the .bat file of my project it gives me an error why?, i can't figure out what is wrong and missing

im new to this please guide and help me

Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
xxx
  • 35
  • 5
  • Can you tell me where are you trying to run your .jar file? Means if it is the same computer where it's developed? – Saud Feb 27 '21 at 06:31
  • im sorry i don't quite get what you mean, I just double click the .bat file (the .jar is inside of it) and then program is running through command prompt – xxx Feb 27 '21 at 06:36
  • Did you link the library containing the Database Driver com.mysql.cj.jdbc.Driver? You may have not included it in your jar. – Sorin Feb 27 '21 at 06:47
  • @xxx Ok. The error you're getting means your MySQL connectivity library is not included. There might be a chance you're not including the above mentioned library with your final build. – Saud Feb 27 '21 at 06:51
  • in the the library? oh no, my library only contains mysql-connector. Would you send me a reference guide, or tell me how to do that? – xxx Feb 27 '21 at 06:53
  • 2
    Kindly check [this answer](https://stackoverflow.com/a/53722642/5082301). Might be of some help to you! – Saud Feb 27 '21 at 07:01

0 Answers0