Question

App Platform - Installing packages using Aptfile

Hello,

I have created a file named Aptfile with the package name of the JDK I want to install (openjdk-21-jdk-headless). But the “java” command-line is not in the PATH environment variable. I found it under “/layers/digitalocean_apt/apt/usr/lib/jvm/java-21-openjdk-amd64/bin”. But when I run my java JAR file, I always get the following error, whatever I do :

error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.InternalError: Error loading java.security file

Why don’t Aptfile never fully installs real Debian packages? I tried to install “language-pack-fr” too but the language is never built and activated.

Is Aptfile supposed to install packages from Debian or what ? What is the purpose of Aptfile ? Why packages get installed into “/layers” ??? What can I do to correctly install additional Linux packages ???

Thank you,

Claude Petit Senior Developer


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
May 7, 2025

Hey Claude!

The Aptfile does install Debian packages, but App Platform uses buildpacks under the hood (just like Heroku), and the packages from your Aptfile get installed into a special layer (that’s the /layers/... path you’re seeing).

Java is there, but you might have to manually add it to your PATH in your start command or your app config. Something like:

export PATH="/layers/digitalocean_apt/apt/usr/lib/jvm/java-21-openjdk-amd64/bin:$PATH"
java -jar your-app.jar

As for language-pack-fr, same issue, those kinds of system-level changes (like locales) might not work as expected in this environment, because it’s not a full VM. App Platform runs in containers with strict buildpack layers, so some things just don’t fully apply.

You could use a Dockerfile to deploy your app so you could install any of the packages that you need:

https://docs.digitalocean.com/products/app-platform/reference/dockerfile/

Alternatively you could use a Droplet where you have full root access:

https://docs.digitalocean.com/products/droplets/

Hope that this helps.

- Bobby

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.