Skip to main content
OpenRocket is a desktop Java application built with the Swing GUI toolkit. It uses the Java Platform Module System (JPMS) to enforce a clean boundary between the simulation backend and the user interface, and Google Guice for dependency injection.

Technology choices

OpenRocket was originally written in Java because Java is platform-independent — the same JAR runs on Windows, macOS, and Linux without modification. While Java desktop applications are less common today, Java’s mature ecosystem of libraries and tools makes it a practical choice for a project of this complexity. OpenRocket is released under the GNU General Public License v3.0, which ensures the source code remains open and free.

Java Platform Module System (JPMS)

OpenRocket uses JPMS to divide the codebase into two explicitly declared modules. Each module is described by a module-info.java file at the root of its source tree (<module>/src/main/java/module-info.java). The file declares:
  • Module name — a unique identifier (e.g., info.openrocket.core)
  • Dependencies — other modules this module requires
  • Exported packages — packages accessible to other modules
  • Services — service interfaces provided or consumed by the module
Using JPMS gives OpenRocket several benefits:

Strong encapsulation

Modules explicitly control which packages they expose. Internal implementation details are hidden from other modules.

Reliable configuration

The module system verifies dependencies at compile time and runtime, preventing missing or incompatible components.

Independent development

Modules can be developed and tested in isolation, making the codebase easier to understand and evolve.

Scalability

The modular structure makes it easier to add new features or replace components without impacting the whole application.

The two modules

info.openrocket.core

The core module contains the simulation backend. It has no dependency on any GUI toolkit, which means it can be embedded in other applications that need rocket simulation capabilities. Key responsibilities:
  • Rocket component model (rocketcomponent package)
  • Aerodynamic calculations using the Barrowman method (aerodynamics package)
  • Flight simulation engine with RK4 integration (simulation package)
  • Mass and CG calculations (masscalc package)
  • File format parsers and writers: .ork, .orc, RockSim, RASAero II (file package)
  • Motor and thrust curve database (motor, thrustcurve packages)
  • Component preset database (preset package)
  • Physical models: atmosphere, gravity, wind (models package)
  • Optimization engine (optimization package)
  • Localization (l10n package)
  • Unit conversion (unit package)
The module declares its dependencies in core/src/main/java/module-info.java:
open module info.openrocket.core {
    requires com.google.guice;
    requires java.desktop;
    requires jakarta.xml.bind;
    requires org.slf4j;
    // ... other dependencies

    exports info.openrocket.core.aerodynamics;
    exports info.openrocket.core.rocketcomponent;
    exports info.openrocket.core.simulation;
    // ... other exported packages
}

info.openrocket.swing

The swing module contains the graphical user interface. It depends on info.openrocket.core with a requires transitive declaration, which means code that requires info.openrocket.swing also automatically gets access to info.openrocket.core. Key responsibilities:
  • Main application window and component tree (gui/main package)
  • Component configuration dialogs (gui/configdialog package)
  • 2D rocket figure rendering (gui/rocketfigure package)
  • 3D visualization with JOGL (gui/figure3d package)
  • Simulation results plots (gui/plot package)
  • Motor selection dialogs (gui/dialogs/motor package)
  • Optimization dialogs (gui/dialogs/optimization package)
  • Printing (gui/print package)
  • UI theming with FlatLaf (gui/theme package)
  • Application startup and Guice wiring (startup package)
The module’s declaration:
open module info.openrocket.swing {
    requires transitive info.openrocket.core;
    requires java.desktop;
    requires com.google.guice;
    requires com.formdev.flatlaf;
    requires org.jogamp.jogl.all;
    // ... other dependencies
}

Dependency injection with Google Guice

OpenRocket uses Google Guice for dependency injection throughout both modules. Guice eliminates manual object construction and wiring, making components easier to test and replace. The application is bootstrapped in the startup package of both modules. Guice Module classes define the bindings — which interface maps to which implementation — and an Injector is created at startup.
The info.openrocket.core module declares Guice service interfaces using uses and provides directives in module-info.java. For example, OptimizableParameterService and SimulationModifierService are loaded through the JPMS service loader mechanism.

Key third-party libraries

LibraryPurpose
Google Guice 7Dependency injection
FlatLafModern Swing look-and-feel with light and dark themes
JOGL (JogAmp)OpenGL-based 3D rocket rendering
JFreeChartSimulation results plots
GraalVM JSJavaScript scripting for simulation extensions
JAXB (Jakarta XML Binding).orc file serialization/deserialization
SLF4J + LogbackLogging
JTS (locationtech)Geometry operations
MigLayoutSwing panel layout

Thrust curves

OpenRocket uses ThrustCurve.org as the source for its motor thrust curve database. Motor data is serialized into a SQLite database file (thrustcurves.db) bundled with the application. The serializeEngines Gradle task fetches and rebuilds this database from the source files.

Units

All internal calculations use pure SI units: meters, kilograms, seconds, Kelvin, radians, and so on. This convention also applies to values stored in .ork files. The only exceptions are:
  • Angles in .ork files — stored in degrees for human readability, even though radians are used internally.
  • Launch site coordinates — latitude and longitude are in degrees both internally and in the file.
When displaying values to users, the info.openrocket.core.unit package converts between SI and the user’s preferred units. The Unit class represents a single unit with conversion methods, and UnitGroup groups related units for a measurable quantity (e.g., temperature: Celsius, Fahrenheit, Kelvin).