Thursday, December 3, 2026 | London 10°C · Drizzle
DailyGlimpse

AI

Java Modules: Short vs. Full Command-Line Options Explained

Durga Software Solutions 1 min read

When working with Java modules, developers often encounter two command-line options that serve the same purpose: -m (shorthand) and --module (full). While both specify the main module to launch, there is a subtle difference in how the module path is provided. Understanding this nuance helps you write cleaner and more consistent commands.

The -m option is a shortcut for --module, but the syntax for passing the module path may vary slightly. Both are equally valid.

For example, to run a module named com.example with the main class Main, you can use:

  • java -m com.example/com.example.Main
  • java --module com.example/com.example.Main

The choice between short and full names often comes down to readability and team conventions. Use whichever makes your build scripts clearer.

React