# JavaAppResource Constructors

- Package: [Aspire.Hosting.Java](/reference/api/csharp/aspire.hosting.java.md)
- Type: [JavaAppResource](/reference/api/csharp/aspire.hosting.java/javaappresource.md)
- Kind: `Constructors`
- Members: `1`

Represents a Java application resource in the distributed application model.

<a id="constructor"></a>
<a id="constructor-string-string"></a>

## JavaAppResource(string, string)

- Name: `Constructor(string, string)`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/f4c27f2d43ddc1cacd0dd083b30d1fea1cee7a62/src/Aspire.Hosting.Java/JavaAppResource.cs#L19)

Represents a Java application resource in the distributed application model.

```csharp
public class JavaAppResource
{
    public JavaAppResource(
        string name,
        string workingDirectory)
    {
        // ...
    }
}
```

## Parameters

- `name` (`string`)
  The name of the resource in the application model.
- `workingDirectory` (`string`)
  The working directory for the Java application.

## Remarks

The command is always `java`. When the application is launched through a Maven goal or a Gradle task, the wrapper script replaces that command; see `WithMavenGoal` and `WithGradleTask`.
