Python to Java Migration
Convert Python scripts to idiomatic Java 25 CLI programs with zero external dependencies.
Decision: Single-File vs Multi-File
Evaluate before writing any code:
- Start with
/java-cli-script— one Java file per Python script, no build tool - Switch to
/java-cli-appwhen any of these apply:- Multiple scripts share >100 lines of identical code (e.g. domain records)
- A single script exceeds ~500 lines
- Scripts import from each other in Python (
from module import func)
When switching to /java-cli-app, extract shared code into common source files within the multi-file project.
Migration Process
- Read all Python scripts — understand dependencies between them (
importgraph) - Identify shared code —
utils.py, common helpers, shared data classes - Decide single-file vs multi-file per the rules above
- Translate each script using the idiom mapping below
- Verify — run each script with
-versionto confirm compilation
Python to Java 25 Idiom Mapping
See references/idiom-mapping.md for the complete translation table covering argument parsing, file I/O, subprocess management, concurrency, and standard library equivalents.