Before you begin to program, you must install some basic tools.
Java/Groovy
JDK (Java Development Kit), such as OpenJDK 11. You can install OpenJDK by following the instructions at adoptopenjdk.net.1
IDE (Integrated Development Environment), such as NetBeans 11.
Groovy: A dynamic language similar to Java that runs on the JVM (Java Virtual Machine).
Install Java and NetBeans 11 or higher. Download and install the Java JDK and NetBeans.2 Open NetBeans and select File ➤ New Project… ➤ Java with Gradle, Java Application. When asked, provide the group “test,” version “0.1,” and package such as “com.gradleproject1”. Click “Finish,” then “OK.”
Install Groovy: Go to the Groovy web site and install Groovy.3
Trying It Out
After installing Groovy, you should use it to try coding. Open a command prompt (or terminal), type groovyConsole, and hit Enter to begin.
In groovyConsole, type the following and then hit Ctrl+r to run the code.
1 print “hello”
Because most Java code is valid Groovy code, you should keep the Groovy console open and use it to try out all of the examples from this book.
Just open your web browser and go to jsfiddle.net.
Others
Go ahead and install these, if you’re in the mood. I’ll wait.
To try out Scala, type scala in your command prompt or terminal once you have installed it.
Code on GitHub
A lot of the code from this book is available on github.com/modernprog.7 You can go there at any time to follow along with the book.