# withJvmArgs

- Module: [CommunityToolkit.Aspire.Hosting.Java](/reference/api/typescript/communitytoolkit.aspire.hosting.java.md)
- Version: `13.4.0`
- Kind: `method`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire)

Configures the Java Virtual Machine arguments for the Java application. The arguments are set via the `JAVA_TOOL_OPTIONS` environment variable, which is recognized by the JVM regardless of how the application is launched (e.g., `java -jar`, Maven wrapper, or Gradle wrapper).

## Definition

```typescript
interface ContainerResource {
  // ... omitted for brevity
  withJvmArgs(args: string[]): IResourceWithEnvironment
}
```

## Parameters

- `args` (`string[]`)

## Returns

`IResourceWithEnvironment` `builder`

## Applies to

- [ContainerResource](/reference/api/typescript/communitytoolkit.aspire.hosting.java/containerresource.md)
- [ExecutableResource](/reference/api/typescript/communitytoolkit.aspire.hosting.java/executableresource.md)
- [ProjectResource](/reference/api/typescript/communitytoolkit.aspire.hosting.java/projectresource.md)
- [DotnetToolResource](/reference/api/typescript/communitytoolkit.aspire.hosting.java/dotnettoolresource.md)
- [CSharpAppResource](/reference/api/typescript/communitytoolkit.aspire.hosting.java/csharpappresource.md)
- [JavaAppContainerResource](/reference/api/typescript/communitytoolkit.aspire.hosting.java/javaappcontainerresource.md)
- [JavaAppExecutableResource](/reference/api/typescript/communitytoolkit.aspire.hosting.java/javaappexecutableresource.md)
