Loos at the sort of code that can throw exceptions. If you get an IOException, that tells you that the IO isn't working, or your file can't be read, or something. You don't know anything about such things at compile time.
Sure. Your code may call methods from classes in some external library, say for example Apache POI. So the compiler needs to see the Apache POI jar to make sure you used the correct class names and method signatures and so on. And in turn the Apache POI jar can (and does) have dependencies on other jars. You're not going to be referencing classes from those other jars directly, so the compiler doesn't need to know about them.
But when you run your code, and it calls methods from the Apache POI jar, those POI methods will in turn call methods from classes in those other dependent jars. So yes, those jars need to be in the classpath at run time or your application is broken.
This isn't just an obscure corner of the Java world, either. It's extremely common, so common that applications have been produced to ensure that when your application has dependencies, you also have copies of the dependencies of those dependencies, and onwards recursively to infinity. Maven is the name you'll commonly see referenced when you want to collect up all of the recursive dependencies. In fact if you search the web for "Apache POI dependencies" you'll find pages which tell you to just use Maven to deal with it.
To amplify on what Paul said, Maven allows you to define what primary jar requirements your project is dependent on. When you define a JAR dependency in a Maven POM file, it has a scope.
The most commonly-used scope is "compile", which causes the dependency to be made available to both compiling and to be included into the Maven-produced product for runtime use.
However, one you'll see especially in web applications is "provided". Which says I need to know about this JAR to compile, but it's provided at runtime by the webapp server, so I don't need it to be included in the Maven product (WAR file). And, in fact, doing so might may the WAR not execute properly.
Loudly announcing something is true and finding out you're wrong makes you feel foolish.
Finding out you're wrong and refusing to admit it makes you LOOK foolish.
Don't destroy the earth! That's where I keep all my stuff! Including this tiny ad: