Requirements
- Java JDK: Java 8 or newer installed and
JAVA_HOMEconfigured.- If your are on a Unix system (MacOS/Linux), SDKMAN is a great tool for managing JDKs.
- Also perfer the latest LTS JDK (currently 25) as it has newer features and fixes.
- Java 8 support is kept, because it is hard to find a decive without support for it.
Quick start — Terminal
Linux / macOS (bash / zsh):
# from project root
./gradlew clean build
./gradlew runWindows (PowerShell):
# from project root
.\gradlew.bat clean build
.\gradlew.bat runWindows (CMD):
cd %~dp0
gradlew.bat clean build
gradlew.bat runNotes:
./gradlew runuses the Gradleapplicationplugin (if configured) to run the app.- To run the produced JAR directly after building:
# replace with the actual jar name in build/libs
java -jar build/libs/JavaAppTemplate-all.jarRun tests
# run tests
./gradlew testRun in Visual Studio Code
- Open the project folder in VS Code.
- Install the Java Extension Pack (provides Language Support, Debugger, Maven/Gradle support).
- Use the Run and Debug view to create or start a Java launch configuration, or:
- Open the built-in Terminal (View → Terminal) and run
./gradlew run(orgradlew.bat runon Windows). - Use the Gradle Tasks view (from the sidebar) to run the
runortesttasks.
- Open the built-in Terminal (View → Terminal) and run
Troubleshooting
- If Gradle complains about Java version, ensure
JAVA_HOMEpoints to a supported JDK and thatjava -versionshows the same.- If you are using SDKMAN run
sdk current java.
- If you are using SDKMAN run
- On Windows, prefer PowerShell or Git Bash for the provided scripts; ensure
gradlew.batis executable. - If you get missing dependency errors, run
./gradlew --refresh-dependencies.
Files
See the main entry point at src/main/java/dev/project516/JavaAppTemplate/Main.java.