... applets ...
5-6 years ago, the applets "ruled", but now they are almost never found, because they have some security problems, and the programmers are trying to avoid them.
... and scripts ...
Java is not a scripting language, but a language that is compiled into bytecode, then this bytecode (during the execution of the application) is either interpreted or it can be compiled by the JIT compiler into machine code.
which compiler to use for writing Java code
Java is officially owned by Oracle, and you can use the JDK - Java Development Kit from the same company (there already has a JavaC compiler) for writing applications in this language: http://www.oracle.com/technetwork/java/javase/ downloads / jdk8-downloads-2133151.html
From books I can advise two:
And if you are completely new to programming, then pay attention to this book:
Fain J. Java programming for children, parents, grandparents