My guess is that your JDBC library is not on your runtime classpath, but maybe one of the Java folk can help you out there.
Couple of other points to bear in mind:
Don't use "SELECT * ...". You may not want to fetch all the columns of a table into your application,. This might be for reasons of security e.g. don't fetch the password - use your WHERE clause to check it within the database, or to save bandwidth and other resources e.g. what if your table has 1000 columns and you're only interested in 3 of them? Use "SELECT col1, col2..." instead.
It's not a good idea to run your app through the "root" DB account, because "root" can do absolutely anything to your database.
You should have a separate DB account for your application which only has the permissions necessary for your application. In fact, it's common to have one DB account for the application
owner, who owns and can modify the relevant DB tables etc, then have a separate DB account for the application
users, who have the minimum permissions needed to read/write data in those tables. Most DBs offer very powerful and flexible access control, so it's a good idea to use these facilities to keep your app secure and prevent people doing stupid things by accident.