Scripting is automation. Scripting languages were specifically developed for automation tasks. They often have features that make scripting easy, e.g. simple mechanisms for invoking other programs or a less strict language (usually, no type system, or no requirement to declare variables, built-in collections, …). E.g. Perl was designed to “make easy things easy and difficult things possible”.
The language runtime of a scripting language often comes pre-installed on target systems, making development and deployment of these automation scripts trivial: just plop a file into this folder and you're done. For example: Shell, Perl, and Python are widely available on most Unix and Linux operating systems.
Compiled languages tend to be different: their languages are often geared towards “serious” programming that involve larger projects. E.g. Java requires substantial boilerplate for even the simplest program. You'll also have to install the toolchain first, and have to compile the code before running it. None of this is insurmountable, but it's a series of extra hurdles.
Of course, the barriers between scripting languages and real languages have completely disappeared by now:
- Java isn't the only language that runs on the JVM. For scripting tasks you might use Groovy.
- Python and PHP are used for huge projects and by now have type systems and OOP support that surpasses that of Java.
- Why should compilation be a hurdle? Many traditionally compiled languages including C, Go, and Haskell have interpreters available, or wrapper scripts that just compile the program on the fly (cint, runhaskell, gorun).
In some circles, it's a serious suggestion that you should use Go instead of Bash for your scripting tasks! That's kind of insane – the two languages do not target even remotely similar tasks – but given the available tooling it's absolutely possible and under some circumstances perhaps even sensible to do so.