Think Java is an introduction to computer science and programming intended for people with little or no experience. The goal is to help students learn to design and implement object-oriented solutions to non-trivial problems.
This book is free to read online and available for purchase in print and electronic formats.
Are you using this book in a class? We'd like to know about it! Please consider filling out this short survey.
Free HTML Version: Read online at GitHub Pages
Free PDF: Download from GitHub (canonical). Stable mirror: greenteapress.com/thinkjava7/thinkjava2.pdf.
Purchase Options (affiliate links):
- Bookshop.org - Support independent bookstores
- Amazon - Kindle and paperback editions
Note: Most readers won't need to build from source. The free HTML version is available online.
- Quarto (required for
make html; install separately, not via conda) - Python 3.12 for conversion scripts — use the conda env below
- LaTeX distribution (texlive-latex-extra, texlive-fonts-recommended on Linux) for PDF
make create_environment # or: mamba env create -f environment.yml
conda activate ThinkJava2Update later with make update_environment. Remove with make delete_environment.
No JDK is required for the interactive HTML book: java-runner runs entirely in the browser.
# HTML version (Quarto) — primary interactive book path
make html
# PDF version (LaTeX) — canonical PDF for GitHub + GTP
make pdf
# Legacy HTML versions
make hevea # static HTML
make trinket # interactive version (Trinket.io; being replaced by java-runner)Same pattern as ThinkDSP: GitHub is canonical; Green Tea Press keeps old URLs in sync.
make pdf # build thinkjava2.pdf
make distrib # confirm the PDF is ready to commit
git add thinkjava2.pdf && git commit && git push
# Optional: mirror to greenteapress.com/thinkjava7/ (requires ~/.ssh/config Host gtp)
make publish-gtp-dry
make publish-gtppublish-gtp rsyncs only the PDF (no --delete, no HeVeA HTML). HTML for readers is Quarto on GitHub Pages.
ThinkJava2/
├── quarto/ # Quarto book project
│ ├── _quarto.yml # Book configuration
│ ├── split_book.py # LaTeX to QMD converter
│ ├── convert.py # LaTeX command converter
│ └── custom.css # Custom styling
├── book/ # Generated Quarto output
├── code/ # Example Java programs
├── figs/ # Source figures (xfig, dia)
├── ch*.tex # Chapter source files
├── app*.tex # Appendix source files
├── thinkjava2.tex # Main LaTeX file
└── Makefile # Build automation
Copyright (c) 2020 Allen B. Downey and Chris Mayfield.
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. See LICENSE for details.