# JavaAppResource.withMainClass

- Module: [Aspire.Hosting.Java](/reference/api/typescript/aspire.hosting.java.md)
- Defined on: [JavaAppResource](/reference/api/typescript/aspire.hosting.java/javaappresource.md)
- Version: `13.6.0-preview.1.26478.8`
- Kind: `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.

## Definition

```typescript
interface JavaAppResource {
  // ... omitted for brevity
  withMainClass(mainClass: string): JavaAppResource;
}
```

## Signature

```typescript
withMainClass(mainClass: string): JavaAppResource
```

## Parameters

- `mainClass` (`string`)

## Returns

[JavaAppResource](/reference/api/typescript/aspire.hosting.java/javaappresource.md) `builder`

## Defined on

- [JavaAppResource](/reference/api/typescript/aspire.hosting.java/javaappresource.md) -- `handle`
