# withMainClass

- Module: [Aspire.Hosting.Java](/reference/api/typescript/aspire.hosting.java.md)
- Version: `13.6.0-preview.1.26478.8`
- Kind: `method`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/f4c27f2d43ddc1cacd0dd083b30d1fea1cee7a62)

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
}
```

## Parameters

- `mainClass` (`string`)

## Returns

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

## Applies to

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