SunLab is a JavaFX application that calculates and visually displays the positions and phases of the sun and moon. It utilizes nearly all features of the commons-suncalc library, available on GitHub and Maven.
SunLab provides the following features, accessible via tabs in the application:
- Daily Information
- Calendar
- Moon Phases
- Moon Parameters
- Solar Parameters
- Sun and Moon Times
- Big Data
- Sunrise and Sunset
- Altitude and Local Time
- Altitude and Azimuth
- Earth-Moon Distance
- Earth-Sun Distance
- Sun Position Diagram (Cartesian)
- Sun Position Diagram (Polar)
The accuracy of the calculated data depends on geographic information, requiring an internet connection to set the location using OpenStreetMap. To select a location, right-click on the map within the application.
To run SunDowner, ensure the following are installed:
- Java SDK: Java 24
- JavaFX SDK: JavaFX
- SceneBuilder: Gluon SceneBuilder (for GUI development, optional for running)
- Apache NetBeans 27 IDE: NetBeans 27 (optional, used for development)
- Download the JavaFX SDK: Extract it to a known location (e.g.,
C:\javafx-sdk-24). - Ensure Java 24 is installed: Verify the
javacommand is accessible in your system's PATH. - Obtain the SunDowner JAR: Place the
Sun-1.0.0.jarfile in a directory of your choice.
Use the provided batch file to launch SunDowner:
- Save the following as
run_sundowner.batin the same directory asSun-1.0.0.jar:
@echo off
REM Batch file to launch the SunDowner JavaFX application
REM Set the path to the SunDowner JAR file
SET JAR_FILE=Sun-1.0.0.jar
REM Set the path to the JavaFX SDK lib folder (update to match your JavaFX SDK location)
SET JAVAFX_LIB=C:\path\to\javafx-sdk-24\lib
REM Specify the main class (update if different or remove if specified in the JAR's manifest)
SET MAIN_CLASS=your.main.Main
REM Run the SunDowner application with required JavaFX modules
java --module-path "%JAVAFX_LIB%" --add-modules javafx.controls,javafx.fxml,javafx.swing -jar %JAR_FILE% %MAIN_CLASS%
REM Pause to keep the window open for debugging (optional, remove if not needed)
pause- Update the
JAVAFX_LIBvariable to point to your JavaFX SDKlibfolder (e.g.,C:\javafx-sdk-24\lib). - If the main class is not specified in the JAR's manifest, update
MAIN_CLASSto the correct fully qualified class name (e.g.,your.main.Main). Otherwise, remove%MAIN_CLASS%from thejavacommand. - Double-click
run_sundowner.bator run it from the command prompt. - Ensure an internet connection is available for OpenStreetMap functionality.
For non-Windows systems, create a shell script (e.g., run_sundowner.sh):
#!/bin/bash
# Script to launch the SunDowner JavaFX application
# Set the path to the SunDowner JAR file
JAR_FILE=Sun-1.0.0.jar
# Set the path to the JavaFX SDK lib folder (update to match your JavaFX SDK location)
JAVAFX_LIB=/path/to/javafx-sdk-24/lib
# Specify the main class (update if different or remove if specified in the JAR's manifest)
MAIN_CLASS=your.main.Main
# Run the SunDowner application with required JavaFX modules
java --module-path "$JAVAFX_LIB" --add-modules javafx.controls,javafx.fxml,javafx.swing -jar $JAR_FILE $MAIN_CLASS- Update the
JAVAFX_LIBandMAIN_CLASSas needed. - Make the script executable:
chmod +x run_sundowner.sh. - Run the script:
./run_sundowner.sh.
- JavaFX Path Error: Ensure the
JAVAFX_LIBpath points to the correct JavaFX SDKlibfolder. - Missing Modules: If the application fails to start, add required JavaFX modules (e.g.,
javafx.graphics) to the--add-modulesflag. - Internet Connection: Verify an active internet connection for OpenStreetMap functionality.
- Main Class Not Found: Confirm the
MAIN_CLASSvariable matches the application's main class or is specified in the JAR's manifest.
