Code Examples for the book "On Java 8"
Switch branches/tags
Nothing to show
Clone or download
Latest commit 7df1639 Jun 16, 2017
Permalink
Failed to load latest commit information.
annotations Pulled main out of ProcessFiles.java so it runs on CI May 16, 2017
arrays Comment spell corrections May 15, 2017
buildSrc/src/main Refactored tagging system May 18, 2017
collections Refactored tagging system May 18, 2017
collectiontopics Comment spell corrections May 15, 2017
com/mindviewinc/simple Date change Dec 31, 2016
compression Refactored tagging system May 18, 2017
concurrent Refactored tagging system May 18, 2017
control Narrowed listing widths, fixed output May 10, 2017
enums Narrowed listing widths, fixed output May 10, 2017
equalshashcode Narrowed listing widths, fixed output May 10, 2017
exceptions Narrowed listing widths, fixed output May 10, 2017
files Exclude Find, PathWatch and TreeWatcher from Gradle May 18, 2017
functional Narrowed listing widths, fixed output May 10, 2017
generics Narrowed listing widths, fixed output May 10, 2017
gradle Update to 3.5 release Apr 16, 2017
hiding Narrowed listing widths, fixed output May 10, 2017
housekeeping From pull request #26 Jun 16, 2017
innerclasses Remove command-line option May 12, 2017
interfaces Narrowed listing widths, fixed output May 10, 2017
iostreams Refactored tagging system May 18, 2017
javadoc Narrowed listing widths, fixed output May 10, 2017
lowlevel Refactored tagging system May 18, 2017
newio Adjustments around validation and %n May 14, 2017
objects Narrowed listing widths, fixed output May 10, 2017
onjava Pulled main out of ProcessFiles.java so it runs on CI May 16, 2017
operators Adjustments around validation and %n May 14, 2017
patterns Only exclude from Travis May 13, 2017
polymorphism Narrowed listing widths, fixed output May 10, 2017
references Narrowed listing widths, fixed output May 10, 2017
reuse Narrowed listing widths, fixed output May 10, 2017
serialization Narrowed listing widths, fixed output May 10, 2017
standardio Refactor/streamify/fix exceptions Jan 22, 2017
staticchecking Date change Dec 31, 2016
streams Narrowed listing widths, fixed output May 10, 2017
strings Refactored tagging system May 18, 2017
typeinfo Narrowed listing widths, fixed output May 10, 2017
validating Travis CI doesn't work with BadMicroBenchmark May 15, 2017
.gitattributes 🎪 Added .gitattributes & .gitignore files Apr 20, 2015
.gitignore Ignore config.py May 5, 2017
.travis.yml Turn off parallel and daemon for clearer output Jan 14, 2017
Copyright.txt Changed appendix name Dec 31, 2016
README.md Improve instructions Nov 23, 2016
appveyor.yml Turn off parallel and daemon for clearer output Jan 14, 2017
build.gradle Integrated Checkstyle and FindBugs Nov 6, 2016
checkstyle.xml Fixed bug, RedundantThrows stopped working May 1, 2017
chkstyle.bat Checkstyle passing May 1, 2017
gradle.properties Trying parallel again May 7, 2017
gradlew gradle wrapper Dec 15, 2015
gradlew.bat gradle wrapper Dec 15, 2015
settings.gradle Combined all subproject build.gradles into master Aug 10, 2016

README.md

To compile and run these programs, you only need JDK 8 installed. Invoking gradlew will automatically download and install Gradle. Gradle will also install all additional libraries necessary to compile and run the Java examples in the book.

To compile and run everything, the command is:

gradlew run

If you are on a Unix/Linux based system, you must select the local directory for all commands, for example:

./gradlew run

To only compile everything, the command is:

gradlew compileJava

To compile only a single chapter (including dependencies), use for example:

gradlew :strings:compileJava

To run only a single chapter, say:

gradlew :strings:run

Gradle can also be used to run a single program. Here, we run the ReplacingStringTokenizer.java program in the strings chapter subdirectory:

gradlew :strings:ReplacingStringTokenizer

However, if the file name is unique throughout the book (the majority are), you can just give the program name, like this:

gradlew ReplacingStringTokenizer

Note that all commands are run from the base directory where the example code is installed, and where you find the gradlew script.

You can learn about other options by just typing gradlew with no arguments.