= Java Application Sample

[.download]
- link:zips/sample_java_application-groovy-dsl.zip[icon:download[] Groovy DSL]
- link:zips/sample_java_application-kotlin-dsl.zip[icon:download[] Kotlin DSL]

NOTE: You can open this sample inside an IDE using the https://www.jetbrains.com/help/idea/gradle.html#gradle_import_project_start[IntelliJ native importer] or https://projects.eclipse.org/projects/tools.buildship[Eclipse Buildship].

If you are new to Gradle and wish to follow a more detailed tutorial for building Java applications, we suggest you have an look at the https://guides.gradle.org/building-java-applications/[Building Java Applications guide].

This sample shows how a Java application can be built with Gradle.
The application has no dependencies and the build has minimal configuration.

====
include::sample[dir="samples/java-application/groovy",files="build.gradle[]"]
include::sample[dir="samples/java-application/kotlin",files="build.gradle.kts[]"]
====

To build and run the application:

====
[.testable-sample,dir="groovy"]
=====
[.sample-command]
----
$ ./gradlew run

> Task :run
Hello, World!

BUILD SUCCESSFUL in 1s
2 actionable tasks: 2 executed
----
=====
====

For more information, see link:{userManualPath}/application_plugin.html[Application Plugin reference chapter].

You can also generate this project locally using link:{userManualPath}/build_init_plugin.html#sec:java_application[`gradle init`].
