Open Source Java Programming Books

Learn Java Programming with 9 Excellent Free Open-Source Books

Java Books

This compilation focuses on the Java language with 9 strong recommendations. There are books here for beginner, intermediate, and advanced programmers alike. All of the texts are released under an open source license. Before exploring my recommendations, I offer a brief introduction to the world of Java.

Java is a general-purpose, concurrent, class-based, object-oriented, high-level programming language and computing platform first released by Sun Microsystems in 1995. It is related in some ways to C and C++, in particular with regard to its syntax, and borrows a few ideas from other languages. Java applications are compiled to bytecode that can run on any Java virtual machine (JVM) regardless of computer architecture.

Java is designed to be simple enough that many programmers can quickly become proficient in the language. It’s one of the most popular programming languages especially for client-server web applications. Some popularity indexes show that Java holds the top spot with C. The respected TIOBE Index (March 2017) shows Java remains the most popular programming language.

We have published a series covering the best open source programming books for other popular languages. Read them here.

Introduction to Programming Using Java

Introduction to Programming Using Java, Seventh Edition

By David J. Eck (755 pages)

Introduction to Programming Using Java is a textbook on introductory programming, which uses Java as the language of instruction. This book is directed mainly towards beginning programmers, although it might also be useful for experienced programmers who want to learn something about Java. It is not designed to provide complete coverage of the Java language.

  • The Mental Landscape
  • Programming in the Small I: Names and Things – covers the basic building blocks – variables, expressions, assignment statements, and subroutine call statements
  • Programming in the Small II: Control – looks at how the building blocks can be put together to build complex programs with more interesting behaviour
  • Programming in the Large I: Subroutines – covers static subroutines only
  • Programming in the Large II: Objects and Classes – covers the creation and use of objects in Java
  • Introduction to GUI Programming – covers the basics of GUI programming
  • Arrays – discusses how arrays are created and used in Java. It also covers the standard class java.util.ArrayList
  • Correctness, Robustness, Efficiency – looks at issues of correctness and robustness of programs. It also looks more closely at exceptions and the try..catch statement, and it introduces assertions, another of the tools that Java provides as an aid in writing correct programs
  • Linked Data Structures and Recursion – looks at two advanced programming techniques, recursion and linked data structures, and some of their applications
  • Generic Programming and Collection Classes – examines how to make pre-written, robust data structures available to programmers
  • Advanced Input/Output: Streams, Files, and Networking – looks at the basic networking API in this chapter
  • Threads and Multiprocessing
  • Advanced GUI Programming – provides a taster for this topic

This work is licensed under a Creative Commons Attribution-Noncommercial-ShareAlike 3.0 License.

Think Java

Think Java – How to Think Like a Computer Scientist

By Allen B. Downey, Chris Mayfield (252 pages)

Think Java is an excellent introduction to Java programming for beginners.

Chapters cover:

  • Variables and types
  • Input and output
  • Void methods
  • Conditionals and logic – includes conditional execution, alternative execution, chained and nested conditionals, the return statement, type conversion, recursion, and stack diagrams for recursive methods
  • Value methods including composition, overloading Boolean expressions and methods, and logical operators
  • Iteration and loops examines the while statement, tables, two-dimensional tables, and encapsulation
  • Strings and things – characters, length, traversal, run-time errors, reading documentation, the indexOf method, looping and counting and more
  • Mutable objects – use two objects from Java libraries, Point and Rectangle
  • Create your own objects
  • Arrays – a set of values where each value is identified by an index
  • Arrays of Objects – defines a Card class and write methods that work with Cards and arrays of Cards
  • Objects of Arrays – creates a Deck class and write methods that operate on Decks
  • Object-oriented programming – presents object-oriented programming (OOP) and transforms the Card and Deck classes into a more OOP style
  • GridWorld: Part 3
  • Appendices: Graphics, Input and Output in Java, Program development, and Debugging

Permission is granted to copy, distribute, transmit and adapt this work under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

Java Application Development on Linux

Java Application Development on Linux

By Carl Albing, Michael Schwarz (599 pages)

Java Application Development on Linux is a hands-on guide to the full Java application development life-cycle on Linux.

This book leads readers through business-logic object analysis, database design, Java servlet UIs, Java Server Pages (JSP) UIs, Swing GUIs, and Standard Widget Toolkit (SWT) GUIs. Scaling up to the enterprise level provides the opportunity to use both the JBoss Application Server and the Apache Geronimo Application Servers, and Enterprise JavaBeans (EJB).

Java Application Development on Linux is targeted at experienced Java programmers who are looking to develop and deploy Java applications on Linux systems.

Learn how to:

  • Use development tools available on Linux, such as the GNU Compiler for Java (gcj), Ant, the NetBeans IDE, IBM’s Eclipse Java IDE, JUnit, and SunONE Studio
  • Develop business logic layers using Java DataBase Connectivity (JDBC)
  • Storing the Data with Oracle, PostgreSQL and MySQL
  • Introduction to JDBC
  • Add a Web interface using servlets and JSPs
  • Add a GUI using Sun’s Abstract Window Toolkit (AWT) and IBM’s SWT Toolkit
  • Servlets
  • JSP: Servlets including how to write a JSP application
  • Deploy EJBs in Linux

This book is part of Bruce Perens’ Open Source Series. All books in this series are released under the Open Publication License, v1.0 or later.

Building Back-End Web Apps with Java, JPA, and JSF

Building Back-End Web Apps with Java, JPA and JSF

By Mircea Diaconescu, Gerd Wagner (181 pages)

This book teaches you how to build Java back-end web applications with Java Server Faces (JSF) as the user interface technology, the Java Persistence API (JPA) for object-to-storage mapping, and a MySQL database.

It follows a “learning by doing” approach, focusing only on the essential parts of Java and the minimum needed for starting to code your first application. The book shows the reader how to build a minimal Java web app in just 7 steps: set up the folder structure, write the model code, configure the app, implement the Create Use Case, implement the Retrieve/List All Use Case, implement the update Use Case, and implement the Delete Use Case. There are practice projects included.

The book, along with any associated source code, is licensed under The Code Project Open License (CPOL).

Open Data Structures

Open Data Structures

By Pat Morin (334 pages)

Open Data Structures covers the implementation and analysis of data structures for sequences (lists), queues, priority queues, unordered dictionaries, ordered dictionaries, and graphs.

Chapters cover:

  • Array-Based Lists – implementations of the List and Queue interfaces where the underlying data is stored in an array, called the backing array
  • Linked Lists – studies implementations of the List interface, using pointer-based data structures instead of arrays
  • Skiplists – a data structure which has a variety of uses
  • Hash Tables – focuses on two of the most common implementations of hash tables: hashing with chaining and linear probing
  • Binary Trees – introduces one of the most fundamental structures in computer science
  • Random Binary Search Trees
  • Scapegoat Trees – a binary search tree data structure
  • Red-Black Trees – a version of binary search trees with logarithmic height
  • Heaps – discusses two implementations of the priority Queue data structure
  • Sorting Algorithms – discusses algorithms for sorting a set of n items
  • Graphs – study two representations of graphs and basic algorithms that use these representations
  • Data Structures for Integers
  • External Memory Searching

The book and is released under a Creative Commons Attribution License. Read the book for free – released in HTML, PDF, and the book’s LaTeX, Java/C++/Python sources can be downloaded from GitHub. There is also a paperback version to buy. The book has been translated into Slovenian and Turkish.

Thinking in Java

Thinking in Java, 3rd Edition

By Bruce Eckel (HTML)

Thinking in Java, 3rd Edition covers many of the nooks and crannies of the Java language, which is of great value in the programming world.

The most prominent feature of the book is its extremely thorough treatment of the Java language, with special attention to object design. Some of the best thinking about objects is in this book, including when to use composition over inheritance. The esoteric details of Java in regard to defining classes are thoroughly laid out.

Topics covered:

  • Object-design basics – an introduction to the basic concepts of OOP, including an overview of development methods
  • Inheritance and polymorphism – Polymorphism allows improved code organization and readability as well as the creation of extensible programs that can be “grown” not only during the original creation of the project but also when new features are desired
  • Object lifetimes – Java provides a feature called a garbage collector that automatically discovers when an object is no longer in use and destroys it
  • Error Handling with exception handling – dealing with errors
  • Analysis and design basics
  • Java basics: keywords and flow control
  • Initializing objects
  • Garbage collection – automatically releases memory resources when they are no longer being used
  • Java packages
  • Designing for reuse: composition vs. inheritance
  • Interfaces and inner classes
  • Arrays and container classes – includes the defining and initializing an array, returning an array, the Arrays class, filling an array, copying an array, comparing arrays, array element comparisons, sorting an array, searching a sorted array, and array summary
  • Java I/O classes – gives the reader an introduction to the variety of I/O classes in the standard Java library and how to use them
  • Concurrency – objects provide a way to divide a program into independent sections
  • Run-time type identification
  • Network programming with sockets
  • Cloning objects – looks at basic threads, sharing limited resources, thread states, cooperation between threads, deadlock and more
  • Creating Windows and Applets – covers the Java 2 Swing library
  • The Java Native Interface (JNI)
  • Java programming guidelines – contains suggestions to help guide the reader in performing low-level program design, and in writing code

While a specific open source license is not cited, the book is free to download and distribute. The revised 4th edition is not released under an open source license.

Java Programming for Kids

Java Programming for Kids

By Yakov Fain (182 pages)

Java Programming for Kids is written for kids aged 12+ and adults wanting a gentle introductory Java book.

The book begins with an introduction to Java and then explains how to write GUI programs illustrating with Tic-Tac-Toe and Ping-Pong games. The book gives good treatment to the basics – classes, Java building blocks, interfaces, lambdas, abstract and anonymous classes are covered. The author then proceeds to examine access levels, collections, generics, multi-threading before offering an introduction to GUI with JavaFX, a library that’s included with JDK, and you can write your GUI programs using familiar Java language.

The reader also learns how to handle run-time errors (known as exceptions), and how to work with files and serialization.

The online version of this book is offered for free under an Creative Commons license.

Apache Jakarta Commons: Reusable Java Components

Apache Jakarta Commons: Reusable Java Components

By Will Iverson (360 pages)

This book is a Java developer’s guide to the Apache Jakarta Commons project. It covers, in detail, the twelve most important Jakarta Commons packages, covering topics ranging from HTTP FileUpload to database connectivity, with sample program code provided for each.

It also offers instruction on how to combine the Commons project libraries with Eclipse.

This book is part of Bruce Perens’ Open Source Series. All books in this series are released under the Open Publication License, v1.0 or later.

What's New in Java 8

What’s New in Java 8

By Adam L. Davis (53 pages)

What’s New in Java 8 is a short introduction to Java 8, the only publicly supported version. The book aims to offer a basic understanding of the new features and be ready to start using it. You’ll need a good understanding of Java the language and the JVM to reap the full benefits of the book. The author helps you understand Java 8, including Project Lambda, the new Date-Time API, Streams, Nashorn, and more.

Java 8 includes the following:

  • Lambda expressions – an anonymous function that you can use to create delegates or expression tree types
  • Method references – compact, easy-to-read lambda expressions for methods that already have a name
  • Default Methods (Defender methods)
  • A new Stream API
  • Optional type – a new container type that wraps a single value, if the value is available
  • A new Date/Time API.
  • Nashorn, the new JavaScript engine – extends Java’s capabilities by running dynamic JavaScript code natively on the JVM
  • Removal of the Permanent Generation
  • and more…

This book is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0).

There are some excellent free-to-download Java programming books which are not released under an open source license. Books written by Oracle are listed first:

Java: A Beginner’s Guide – introduces you to Java, including its history, its design philosophy, and several of its most important features
The Java Language Specification – available for Java SE 6, 7 and 8
The Java Tutorials – practical guides for programmers who want to use the Java programming language to create applications
The Java EE Tutorial, Release 7

Introduction to Programming in Java – teaches the classic elements of programming, using an “objects-in-the-middle” approach that emphasizes data abstraction
Docker for Java Developers – explains Docker’s basic concepts and the commonly used orchestration frameworks around them
OOP – Learn Object Oriented Thinking & Programming – a record of the dialogue of the author with his daughter who wants to learn programming
Learning Java – gives you a thorough grounding in Java fundamentals and APIs
Core Servlets and JavaServer Pages – looks at the advanced features and latest developments regarding servlets and JSP
Data Structures and Algorithms with Object-Oriented Design Patterns in Java
Processing XML with Java – a complete tutorial about writing Java programs that read and write XML documents


Ada, Assembly, Awk, Bash, C, C++, C#, Clojure, CoffeeScript, ECMAScript, Erlang, Forth, Fortran, Go, Haskell, HTML, Java, JavaScript, LaTeX, Lisp, Logo, Lua, OCaml, Pascal, Perl, PHP, Prolog, Python, R, Ruby, Rust, Scala, Scheme, Scratch, SQL, Swift, TeX, VimL

Click to rate this software
[Total: 1 Average: 5]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.