Modern Java Examples — A modular collection of 20 self-contained Java 25 example applications managed with a single Maven reactor POM.
The repository covers desktop GUI development (Swing and Java 3D), networking (Sockets and RMI), JDBC and SQLite, XML and JSON processing, reflection, image processing, multithreading, minimax AI, stable Java 25 language/API features, a local Markdown knowledge base, an RSS/Atom reader, file integrity scanning, and collaborative LAN drawing.
Originally written between 2005 and 2009, expanded and modernized in 2026 as a Java 25, 20-module Maven workspace.
modern-java-examples/
├── .github/
│ ├── dependabot.yml # Weekly Maven & GitHub Actions updates
│ └── workflows/ci.yml # Maven verification & CodeQL CI
├── pom.xml # Unified Java 25 Maven reactor configuration
├── README.md
├── CHANGELOG.md
├── LICENSE
├── one-operation/ # Genetic-algorithm arithmetic game
├── chat/ # Socket chat client/server
├── currency-reader/ # XML currency exchange reader
├── db2pojo/ # Database-to-POJO generator
├── dsrmi/ # Distributed RMI example
├── file-integrity-scanner/ # Read-only SHA-256 duplicate-file scanner
├── java-25-features/ # Stable Java 25 language and API examples
├── lan-whiteboard/ # Collaborative drawing over a bounded TCP protocol
├── markdown-knowledge-base/ # Local Markdown notes with search
├── rss-atom-reader/ # Swing RSS and Atom feed reader
├── java3d-examples/ # Java 3D scenes and demos
├── jdbc/ # JDBC and SQLite example
├── jdip/ # Digital image-processing application
├── notepad/ # Minimal Swing text editor
├── online-translator/ # HTTP-based translator example
├── reflection/ # Java Reflection API examples
├── simple-browser/ # Swing browser with SQLite bookmarks
├── socket-calculator/ # TCP calculator client/server
├── thread-sync/ # Producer/consumer synchronization
└── tic-tac-toe/ # Tic-Tac-Toe with minimax AI
| Directory | Main Class | Description |
|---|---|---|
one-operation/ |
oneoperation.Main |
Educational implementation of the arithmetic game using genetic algorithms. |
chat/ |
chat.Main |
Multi-user chat implementation using sockets. |
currency-reader/ |
currencyreader.Main |
XML reading and currency parsing example. |
db2pojo/ |
db2pojo.Db2Pojo |
Swing tool that generates POJO classes from database metadata. |
dsrmi/ |
dsrmi.client.ClientFrame |
Java RMI distributed information retrieval example with Jackson XML. |
file-integrity-scanner/ |
integrity.Main |
Read-only recursive SHA-256 scanning with duplicate detection and progress. |
java-25-features/ |
features.ModuleImportExample |
Module imports, scoped values, flexible constructor bodies, and compact source files. |
lan-whiteboard/ |
lanwhiteboard.Main |
Collaborative Swing drawing over TCP with virtual-thread clients. |
markdown-knowledge-base/ |
knowledgebase.Main |
Local-first Markdown notes with title/content search and modified-time metadata. |
rss-atom-reader/ |
feedreader.Main |
RSS 2.0 and Atom reader with saved subscriptions and asynchronous refresh. |
java3d-examples/ |
j3d.DisplayFrame |
Java 3D scenes, animation, textures, lighting, and object loading. |
jdbc/ |
jdbc.Main |
JDBC connection and SQLite data-access example. |
jdip/ |
jdip.MainWindow |
Digital image-processing application with reusable filters. |
notepad/ |
notepad.Main |
Small Swing text editor. |
online-translator/ |
translator.Main |
HTTP translator example using Apache HttpComponents and jsoup. |
reflection/ |
reflector.Main |
Java Reflection API class inspection example. |
simple-browser/ |
browser.Main |
Browser UI backed by an SQLite bookmark database. |
socket-calculator/ |
socketcalculator.Client |
Calculator implemented with a TCP client/server protocol. |
thread-sync/ |
ds.Main |
Thread synchronization with producer, consumer, and shared-silo examples. |
tic-tac-toe/ |
xox.Main |
Tic-Tac-Toe Swing application with minimax AI. |
The Maven command compiles the selected module and uses its main.class property,
so no versioned jar filename needs to be maintained in this README. Each row
describes the expected first result:
| Module | Command | Expected result |
|---|---|---|
one-operation |
mvn -pl one-operation compile exec:java |
Starts the arithmetic game. |
chat |
mvn -pl chat compile exec:java |
Opens the chat application. |
currency-reader |
mvn -pl currency-reader compile exec:java |
Loads and displays current currency values; internet access is required. |
db2pojo |
mvn -pl db2pojo compile exec:java |
Opens the database-to-POJO generator. |
dsrmi |
mvn -pl dsrmi compile exec:java |
Starts the RMI client; an RMI service must be available. |
file-integrity-scanner |
mvn -pl file-integrity-scanner compile exec:java -Dexec.args="/path/to/folder" |
Reports file hashes and duplicate groups without modifying files. |
java-25-features |
mvn -pl java-25-features compile exec:java |
Prints a summary of stable Java 25 features. |
lan-whiteboard |
mvn -pl lan-whiteboard compile exec:java -Dexec.args="--host 0.0.0.0 5555" |
Hosts a shared canvas on port 5555; connect from another device using --connect <host> 5555. |
markdown-knowledge-base |
mvn -pl markdown-knowledge-base compile exec:java |
Opens a local Markdown note editor with live search. |
rss-atom-reader |
mvn -pl rss-atom-reader compile exec:java |
Opens the feed reader; adding and refreshing feeds requires internet access. |
java3d-examples |
mvn -pl java3d-examples compile exec:java |
Opens a Java 3D demo; platform-specific native libraries may be required. |
jdbc |
mvn -pl jdbc compile exec:java |
Starts the JDBC example. |
jdip |
mvn -pl jdip compile exec:java |
Opens the image-processing application. |
notepad |
mvn -pl notepad compile exec:java |
Opens the text editor. |
online-translator |
mvn -pl online-translator compile exec:java |
Opens the translator; provider requests require internet access. |
reflection |
mvn -pl reflection compile exec:java |
Starts the reflection example. |
simple-browser |
mvn -pl simple-browser compile exec:java |
Opens the browser with local SQLite bookmarks. |
socket-calculator |
mvn -pl socket-calculator compile exec:java |
Starts the calculator client; start its server first. |
thread-sync |
mvn -pl thread-sync compile exec:java |
Runs the producer-consumer synchronization demo. |
tic-tac-toe |
mvn -pl tic-tac-toe compile exec:java |
Opens the Tic-Tac-Toe game. |
Java 25 feature module output:
Java 25 stable features: module imports, Scoped Values, flexible constructor bodies
The compact source-file example can also be launched directly with Java 25:
java java-25-features/src/main/java/CompactHello.javaJava 25: compact source files, instance main methods
- JDK 25
- Maven 3.9 or newer
Verify the local toolchain:
java -version
mvn -versionBuild and verify every module from the repository root:
git clone https://github.com/tekrei/modern-java-examples.git
cd modern-java-examples
mvn clean verifyBuild one module:
mvn -pl tic-tac-toe -am clean packageRun the unit tests:
mvn test
mvn -pl one-operation testAll 20 modules include JUnit Jupiter test sources covering public APIs or isolated, testable example behavior.
Run a module through Maven:
mvn -pl tic-tac-toe compile exec:java
mvn -pl currency-reader compile exec:java
mvn -pl notepad compile exec:javaThe root pom.xml is the parent POM and Maven reactor. The release version is stored once in its revision property; child POMs use Maven's ${revision} placeholder. Child modules also inherit Java 25 compilation, JUnit Jupiter test support, Surefire, and assembly configuration.
mvn clean compile
mvn test
mvn clean verify
mvn -pl dsrmi -am clean packageDependency updates are available directly through the root POM:
mvn versions:display-dependency-updates
mvn versions:display-plugin-updatesApply only after reviewing the report:
mvn versions:use-latest-releases -DallowSnapshots=false -DgenerateBackupPoms=false- Dependabot: Weekly Maven dependency and GitHub Actions updates.
- Java CI: Builds and verifies all modules on JDK 25.
- CodeQL: Performs Java security analysis for pushes, pull requests, and weekly scans, using an explicitly configured JDK 25.
The LAN whiteboard demo has no authentication or encryption; use it only on a trusted network.
See CHANGELOG.md for the version history.
This project is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License v3.0 or later. See LICENSE for details.