---
Product: Aspose.Slides
Platform: java
Page Type: kb
Canonical URL: https://kb.aspose.org/slides/java/how-to-get-started-slides-java
Last Updated: 2026-04-04
---

# How to Get Started with Aspose.Slides FOSS for Java

Learn how to install aspose-slides-foss via Maven, create a presentation, add shapes and text, apply fills, and save to PPTX using Presentation, SaveFormat, and ShapeType.

`aspose-slides-foss` for Java is a free, MIT-licensed library for creating and editing
PowerPoint `.pptx` files — no Microsoft Office required, available on Maven Central.

## Step-by-Step Guide

### Step 1: Add the Maven Dependency

Add the dependency to your `pom.xml` (Java 21 or later required):

```xml
<dependency>
  <groupId>org.aspose</groupId>
  <artifactId>aspose-slides-foss</artifactId>
  <version>26.7.0</version>
</dependency>
```

Verify the package resolves correctly by building the project:

```bash
mvn dependency:resolve
```

---

### Step 2: Import Required Classes

Import the classes you need for loading presentations and saving:

```java
import org.aspose.slides.foss.Presentation;
import org.aspose.slides.foss.ISlide;
import org.aspose.slides.foss.IAutoShape;
import org.aspose.slides.foss.ITextFrame;
import org.aspose.slides.foss.ShapeType;
import org.aspose.slides.foss.FillType;
```

---

### Step 3: Create a Presentation

Construct a `Presentation` with no arguments to start with one blank slide. Always use
try-with-resources to ensure internal resources are released:

```java
import org.aspose.slides.foss.Presentation;

try (Presentation prs = new Presentation()) {
    System.out.println("Slides: " + prs.getSlides().size());
    prs.save("new_presentation.pptx");
}
```

---

### Step 4: Add a Shape with Text

Use `slide.getShapes().addAutoShape()` to insert a rectangle, then call `addTextFrame()`
to add text content:

```java
import org.aspose.slides.foss.Presentation;
import org.aspose.slides.foss.ISlide;
import org.aspose.slides.foss.IAutoShape;
import org.aspose.slides.foss.ITextFrame;
import org.aspose.slides.foss.IPortionFormat;
import org.aspose.slides.foss.ShapeType;
import org.aspose.slides.foss.NullableBool;

try (Presentation prs = new Presentation()) {
    ISlideCollection slides = prs.getSlides();
    ISlide slide = slides.get(0);
    IAutoShape shape = slide.getShapes().addAutoShape(
        ShapeType.RECTANGLE, 50, 50, 400, 150
    );
    ITextFrame tf = shape.addTextFrame("Hello from Aspose.Slides FOSS!");
    IPortionFormat fmt = tf.getParagraphs().get(0).getPortions().get(0).getPortionFormat();
    fmt.setFontHeight(24);
    fmt.setFontBold(NullableBool.TRUE);
    prs.save("with_shape.pptx");
}
```

---

### Step 5: Apply a Fill and Save

Set a solid fill color on the shape before saving:

```java
import org.aspose.slides.foss.Presentation;
import org.aspose.slides.foss.IAutoShape;
import org.aspose.slides.foss.ShapeType;
import org.aspose.slides.foss.FillType;
import org.aspose.slides.foss.drawing.Color;

try (Presentation prs = new Presentation()) {
    ISlideCollection slides = prs.getSlides();
    ISlide slide = slides.get(0);
    IAutoShape shape = slide.getShapes().addAutoShape(
        ShapeType.RECTANGLE, 100, 100, 400, 200
    );
    shape.getFillFormat().setFillType(FillType.SOLID);
    shape.getFillFormat().getSolidFillColor().setColor(new Color(70, 130, 180));
    shape.addTextFrame("Styled shape");
    prs.save("styled.pptx");
}
```

## Common Issues and Fixes

**`ClassNotFoundException` for `org.aspose.slides.foss.Presentation`**
The Maven dependency is not resolved. Run `mvn dependency:resolve` and check that the
artifact is available in Maven Central. Verify the version in `pom.xml`.

**`UnsupportedOperationException` when calling certain methods**
Some features (charts, animations, PDF export) throw `UnsupportedOperationException`
in this release. Check the known limitations section of the API reference before using
advanced features.

**Shape coordinates seem off**
Coordinates and dimensions are in EMU (English Metric Units). One point is approximately
12700 EMU. The default slide is 9144000 × 6858000 EMU.

**File not found when loading an existing PPTX**
Pass an absolute path or ensure the working directory is set correctly:

```java
import java.nio.file.Paths;
String path = Paths.get("presentations", "existing.pptx").toAbsolutePath().toString();
try (Presentation prs = new Presentation(path)) { }
```

## Frequently Asked Questions

### Does aspose-slides-foss require Microsoft Office?

No. The library creates and reads `.pptx` files natively in pure Java with no dependency
on Microsoft Office, COM automation, or Windows APIs.

### Which Java versions are supported?

Java 21 or later. The library runs on Windows, macOS, Linux, and Docker containers.

### Is the library free for commercial use?

Yes. It is released under the MIT License. You may use, modify, and redistribute it for
any purpose, including commercial applications.

### Can I load an existing PPTX file?

Yes. Pass the file path to the `Presentation` constructor to load the existing file into memory:

```java
try (Presentation prs = new Presentation("existing.pptx")) {
    System.out.println("Loaded " + prs.getSlides().size() + " slides");
    prs.save("copy.pptx");
}
```

### Do I need to close the Presentation explicitly?

Yes. `Presentation` implements `AutoCloseable`. Always use try-with-resources
(`try (Presentation prs = new Presentation()) { ... }`) to guarantee cleanup.

## See Also

- [FAQ — Aspose.Slides FOSS for Java](https://kb.aspose.org/slides/java/faq/)
- [How to Create Presentations in Java](https://kb.aspose.org/slides/java/how-to-create-presentations-java/)
- [How to Add Shapes in Java](https://kb.aspose.org/slides/java/how-to-add-shapes-java/)
- [Getting Started Docs](https://docs.aspose.org/slides/java/getting-started/)
- [API Reference](https://reference.aspose.org/slides/java/)
- [Aspose.Slides for Java — Enterprise Knowledge Base](https://kb.aspose.com/slides/java/)