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:

enter image description here

enter image description here

enter image description here

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

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -