Scan java code not compiled code

Can I scan java code with Sonarcube (not compiled code)

You need to provide the compiled bytecode for anlaysis – which mean running a build, at some point. We think this is best orchestrated with tools like the SonarScanner for Maven or SonarScanner for Gradle which integrate right in the build system.