mirror of
https://github.com/cosinekitty/astronomy.git
synced 2026-08-04 12:02:28 -04:00
Run the Java demo unit test as part of the automated test suite. If the test fails, print the xml test results to the screen, so if it happens in GitHub Actions, we can see what went wrong and diagnose the problem.
Astronomy Engine examples in Java
The class file Main.java shows examples of how to use the Kotlin version of Astronomy Engine from a Java program.
The demo program is split into separate source files, one for each topic, as listed below. Each topic is chosen by a command line parameter. To build the demo program, run this command in Linux or Mac:
./gradlew jar
On Windows, use this command to build the demo program:
gradlew.bat jar
Then run the program with no command line parameters to see usage text:
java -jar build/libs/astronomy-demo-1.0.0.jar
As an example, to run the MoonPhase demo, try this:
java -jar builds/lib/astronomy-demo-1.0.0.jar moonphase
MoonPhase.java
This example shows how to determine the Moon's current phase, and how to predict when the next 10 quarter phases will occur.