java - Unhandled exception compile error: ClassNotFoundException -
i know common question, despite adding mysql-connector library in intellij idea, ide still can't seem locate class. can see in screenshots below, have added mysql-connector jar library project, yet doesn't seem see present:



i haven't been able find solution other 'add library project'. seems though there missing step somewhere...
you need add library dependency module needs it.
choose project settings > modules. select module needs library (in case seems have 1 module in project, chatbot). select dependencies tab. click '+' button , choose library...). finally, select mysql-connector.. library added project.
edit: see wasn't problem @ all. problem code have unhandled exception class.forname(). method can throw checked exception: classnotfoundexception, must handled adding catch or adding throws classnotfoundexception method signature of getconnection().
in such cases error in code, easiest way figure out what's wrong move caret code red squigly line , see idea says in bottom status bar. alternatively can hover mouse pointer above , error message presented popup.
Comments
Post a Comment