Everything in this book runs in the page. When you want your programs in files of your own, start from the kit: the book’s Pict library, JUnit for testing, and a small example of each. There are two ways to get it.
In a Codespace
Open the kit in a GitHub Codespace. A Codespace is VS Code running in your browser on a computer GitHub provides, with Java 25 and the Java extensions already installed; the first start takes a minute or two. You need a GitHub account, and a Codespace you leave alone for a few weeks is deleted, so download anything you want to keep.
On your own computer
Download the kit (a zip; it is also on GitHub as the kit repository). You will need Java 25 or newer: install a JDK from adoptium.net, then check with
java -versionWhat is in it
Pict.java— the library this book uses, the same file the book’s pages run. On your computerImageIO_.showopens a window instead of drawing below the code (a Codespace has no display, so there it savesshown-0.png), and file names are relative to the folder you runjavain.Example.java— a program that uses it.ExampleTest.java— JUnit tests.lib/junit.jar— JUnit itself, under its license.README.md— these instructions, short.
Running a program
In the kit’s folder:
java -ea Example.javaJava compiles Example.java, and the Pict.java next to it, as it starts; -ea turns on assert, as the book’s widgets do. This one saves example.png.
Running the tests
javac -d out -cp lib/junit.jar *.java
java -jar lib/junit.jar execute --class-path out --scan-class-pathThe first line compiles everything into out/; the second finds every @Test there and runs it. In VS Code, the Testing panel does the same.