Pegasus Posted August 15, 2018 Share Posted August 15, 2018 (edited) I made a project with Intellij which is not osrs related. The project use database. The project works when I run it in Intellij. However, the runnable JAR (.jar) compiled by IntelliJ shows this error when I run it. I already added mysql-connector-java-5.1.38-bin.jar to artifact, and IntelliJ generated mysql-connector-java-5.1.38-bin.jar and the program jar when I click rebuild artifact. I don't use maven. Could anyone tell me how to solve it step by step? Edited August 15, 2018 by Pegasus Quote Link to comment Share on other sites More sharing options...
Hi G00gle Posted August 15, 2018 Share Posted August 15, 2018 (edited) https://stackoverflow.com/questions/23771129/cant-test-connection-to-mysql-using-intellij Are you able to get a connection? A solution might be in there, thought I'd put it in here. Edited August 15, 2018 by Hi G00gle Quote Link to comment Share on other sites More sharing options...
Pegasus Posted August 15, 2018 Author Share Posted August 15, 2018 5 minutes ago, Hi G00gle said: https://stackoverflow.com/questions/23771129/cant-test-connection-to-mysql-using-intellij Are you able to get a connection? A solution might be in there, thought I'd put it in here. The project works when I run it in intellij. However, when my pc have low memory or I just don't want to turn on intellij, I will just want to double click the .jar file, but it shows java.lang.ClassNotFoundException: com.mysql.jdbc.Driver Quote Link to comment Share on other sites More sharing options...
Pegasus Posted August 17, 2018 Author Share Posted August 17, 2018 please help Quote Link to comment Share on other sites More sharing options...
Lordsthan Posted August 17, 2018 Share Posted August 17, 2018 I'm not an expert on Intellij IDEA but I quickly made a project to test and it works both on IDE and .jar. Here is my artifacts settings: Quote Link to comment Share on other sites More sharing options...
Pegasus Posted August 21, 2018 Author Share Posted August 21, 2018 (edited) where do you download this latest version of mysql-connector-java-8.0.12.jar file? https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.12/ How to delete mention? Not work after I use the mysql-connector-java-8.0.12.jar too. Could you tell me how do you do it step by step? @Lordsthan Edited August 21, 2018 by Pegasus Quote Link to comment Share on other sites More sharing options...
Lordsthan Posted August 21, 2018 Share Posted August 21, 2018 7 hours ago, Pegasus said: where do you download this latest version of mysql-connector-java-8.0.12.jar file? https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.12/ How to delete mention? Not work after I use the mysql-connector-java-8.0.12.jar too. Could you tell me how do you do it step by step? @Lordsthan Sure, pm'd. 1 Quote Link to comment Share on other sites More sharing options...
Pegasus Posted August 22, 2018 Author Share Posted August 22, 2018 10 hours ago, Lordsthan said: Sure, pm'd. Thanks for making step by step video. problem fixed 1 Quote Link to comment Share on other sites More sharing options...
erichydi Posted October 12, 2020 Share Posted October 12, 2020 As the name suggests classNotFoundException in Java occurs when JVM (Java Virtual Machine) tries to load a particular class and doesn't found the requested class in the classpath you specified. When building the project, java throws ClassNotFoundException exception because a file (the com.mysql.jdbc.Driver class) from the java mysql connectivity library is not found. The solution is adding the library to the project, and java will find the com.mysql.jdbc.Driver Quote Link to comment Share on other sites More sharing options...