First, 6.1 is quite old at this point. You should upgrade to the current LTS, 7.9.1, or the current version, 8.0, at your earliest convenience. Note that you’ll have to hit 6.7.6 in between.
Regarding your error, you must compile the code before you can analyze it, and then provide the location of your compiled class files to analysis (if you’re using the Scanner for Maven or the Scanner for Gradle that part will happen automatically).