# Aspire.Hosting.Java

- Module: `Aspire.Hosting.Java`
- Version: `13.6.0-preview.1.26478.8`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/f4c27f2d43ddc1cacd0dd083b30d1fea1cee7a62)
- Functions: `15`
- Types: `2`

## Types

- [JavaAppResource](/reference/api/typescript/aspire.hosting.java/javaappresource.md) -- `handle` - 9 members -- Represents a Java application resource in the distributed application model.
- [JavaContainerResource](/reference/api/typescript/aspire.hosting.java/javacontainerresource.md) -- `handle` - 0 members -- Represents a Java application that runs from a prebuilt container image.

## Functions

- [addJavaApp](/reference/api/typescript/aspire.hosting.java/addjavaapp.md) -- `method` -- Adds a Java application to the application model, launched with `java`.
- [addJavaAppWithJar](/reference/api/typescript/aspire.hosting.java/addjavaappwithjar.md) -- `method` -- Adds a Java application that runs a prebuilt JAR with `java -jar`.
- [addJavaContainer](/reference/api/typescript/aspire.hosting.java/addjavacontainer.md) -- `method` -- Adds a Java application that runs from an existing container image.
- [addQuarkusApp](/reference/api/typescript/aspire.hosting.java/addquarkusapp.md) -- `method` -- Adds a Quarkus application to the application model, built and launched with its own Maven or Gradle wrapper.
- [addSpringBootApp](/reference/api/typescript/aspire.hosting.java/addspringbootapp.md) -- `method` -- Adds a Spring Boot application to the application model, built and launched with its own Maven or Gradle wrapper.
- [withGradleBuild](/reference/api/typescript/aspire.hosting.java/withgradlebuild.md) -- `method` -- Runs a Gradle build before the Java application starts.
- [withGradleTask](/reference/api/typescript/aspire.hosting.java/withgradletask.md) -- `method` -- Launches the Java application through a Gradle task instead of `java`, for example `bootRun`.
- [withJarArtifact](/reference/api/typescript/aspire.hosting.java/withjarartifact.md) -- `method` -- Selects the JAR the generated container image runs, for projects whose build produces more than one.
- [withJvmArgs](/reference/api/typescript/aspire.hosting.java/withjvmargs.md) -- `method` -- Adds arguments to the Java Virtual Machine that runs the application.
- [withMainClass](/reference/api/typescript/aspire.hosting.java/withmainclass.md) -- `method` -- Sets the main class an IDE launches when running or debugging this application. Has no effect on how Aspire starts the process, which is decided by the JAR path, Maven goal, or Gradle task.
- [withMavenBuild](/reference/api/typescript/aspire.hosting.java/withmavenbuild.md) -- `method` -- Runs a Maven build before the Java application starts.
- [withMavenGoal](/reference/api/typescript/aspire.hosting.java/withmavengoal.md) -- `method` -- Launches the Java application through a Maven goal instead of `java`, for example `spring-boot:run`.
- [withOtelAgent](/reference/api/typescript/aspire.hosting.java/withotelagent.md) -- `method` -- Runs the application with the OpenTelemetry Java agent so it exports traces, metrics, and logs to Aspire.
- [withOtelAgentDefaultPath](/reference/api/typescript/aspire.hosting.java/withotelagentdefaultpath.md) -- `method` -- Runs the application with the OpenTelemetry Java agent from the location the build tool writes it to.
- [withWrapperPath](/reference/api/typescript/aspire.hosting.java/withwrapperpath.md) -- `method` -- Overrides the build tool wrapper script path, for repositories whose wrapper is not in the default location or does not use the default name.
