> ## Documentation Index
> Fetch the complete documentation index at: https://developer.upsun.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Java

> Java is a general-purpose programming language, and one of the most popular in the world today. Upsun Cloud supports Java runtimes that can be used with build management tools such as Gradle, Maven, and Ant.

> [!TIP]
>
> You can now use composable image to install runtimes and tools in your application container. To find out more, see the [Composable image](https://developer.upsun.com/docs/configure-apps/app-reference/composable-image.md) topic.

## Supported versions

You can select the major version. But the latest compatible minor version is applied automatically and can’t be overridden.

Patch versions are applied periodically for bug fixes and other maintenance updates. By default, you get the latest available patches each time you deploy. If your project has a [maintenance window](https://developer.upsun.com/docs/core-concepts/build-deploy.md#maintenance-window) configured, Upsun Cloud applies patches only during that window. Upsun Cloud may still apply urgent or critical fixes outside of the maintenance window.

### OpenJDK versions:

* 25
* 21

These versions refer to the headless packages of OpenJDK.
To save space and reduce potential vulnerabilities, they don't contain GUI classes, which can't be used on the server.

## Deprecated versions

The following versions are still available in your projects,
but they're at their end of life and are no longer receiving security updates from upstream.

*No deprecated versions.*

To ensure your project remains stable in the future, switch to a [supported version](#supported-versions).

## Retired versions

The following versions have been retired and are no longer available.
If your project uses a retired version, you must update to a [supported version](#supported-versions).

* 19
* 18
* 17
* 14
* 13
* 12
* 11
* 8

### Specify the language

To use Java, specify `java` as your [app's `type`](https://developer.upsun.com/docs/configure-apps/app-reference/single-runtime-image#type):


&#x20;   applications:
&#x20;     \# The app's name, which must be unique within the project.
&#x20;     \<APP\_NAME>:
&#x20;       type: 'java:\<VERSION\_NUMBER>'
&#x20;&#x20;

For example:


&#x20;   applications:
&#x20;     \# The app's name, which must be unique within the project.
&#x20;     myapp:
&#x20;       type: 'java:\{\{version:java:latest}}'

## Support build automation

Upsun Cloud supports the most common project management tools in the Java ecosystem, including:

* [Gradle](https://gradle.org/)
* [Maven](https://maven.apache.org/)
* [Ant](https://ant.apache.org/)

### Manage Maven versions

Java containers come with a version of Maven already installed.
You may need to use a specific different version to manage your project.
If the version you need differs from the version on your container, you can install the specific version that you need.

Add something like the following to your [app configuration](https://developer.upsun.com/docs/configure-apps):


&#x20;   applications:
&#x20;     \# The app's name, which must be unique within the project.
&#x20;     myapp:
&#x20;       type: 'java:\{\{version:java:latest}}'

&#x20;       variables:
&#x20;         env:
&#x20;           MAVEN\_VERSION: \<DESIRED\_VERSION\_NUMBER>

&#x20;       hooks:
&#x20;         build: |
&#x20;           curl -sfLO "https\://dlcdn.apache.org/maven/maven-3/\$MAVEN\_VERSION/binaries/apache-maven-\$MAVEN\_VERSION-bin.tar.gz"
&#x20;           tar -zxf apache-maven-\$MAVEN\_VERSION-bin.tar.gz
&#x20;           export PATH="\$PWD/apache-maven-\$MAVEN\_VERSION/bin:\$PATH"
&#x20;           mvn --version
&#x20;           mvn clean package

## Other JVM languages

It’s worth remembering that the JVM by its specification [doesn't read Java code](https://docs.oracle.com/javase/specs/jvms/se8/html/index.html), but bytecode. So within the JVM, it’s possible to [run several languages](https://en.wikipedia.org/wiki/List_of_JVM_languages). Upsun Cloud supports several of them, such as Kotlin, Groovy, and Scala, so long as that language works with any build automation that Upsun Cloud supports.

| Article | Link |
| - | - |
| Kotlin and Spring | [Source](https://github.com/platformsh-templates/spring-kotlin) |
| [Scala and Spring](https://dzone.com/articles/spring-scala-cloud-psh) | [Source](https://github.com/platformsh-examples/scala) |

> [!NOTE]
>
> While the table above shows examples for Platform.sh rather than for Upsun Cloud, the same rules apply with only slight changes in configuration.

## Accessing services

You can access service credentials to connect to [managed services](https://developer.upsun.com/docs/add-services) from environment variables present in the application container.
Consult each of the individual service documentation to see how to retrieve and surface credentials into your application.

* [ClickHouse](https://developer.upsun.com/docs/add-services/clickhouse.md#usage-example)
* [Elasticsearch](https://developer.upsun.com/docs/add-services/elasticsearch.md#usage-example)
* [Gotenberg](https://developer.upsun.com/docs/add-services/gotenberg.md#usage-example)
* [Headless Chrome](https://developer.upsun.com/docs/add-services/headless-chrome.md#usage-example)
* [InfluxDB](https://developer.upsun.com/docs/add-services/influxdb.md#usage-example)
* [Kafka](https://developer.upsun.com/docs/add-services/kafka.md#usage-example)
* [MariaDB/MySQL](https://developer.upsun.com/docs/add-services/mysql#usage-example)
* [Memcached](https://developer.upsun.com/docs/add-services/memcached.md#usage-example)
* [mercure](https://developer.upsun.com/docs/add-services/mercure.md#usage-example)
* [mongodb](https://developer.upsun.com/docs/add-services/mongodb.md#usage-example)
* [Network Storage](https://developer.upsun.com/docs/add-services/network-storage.md#usage-example)
* [OpenSearch](https://developer.upsun.com/docs/add-services/opensearch.md#usage-example)
* [PostgreSQL](https://developer.upsun.com/docs/add-services/postgresql#usage-example)
* [RabbitMQ](https://developer.upsun.com/docs/add-services/rabbitmq.md#usage-example)
* [Redis](https://developer.upsun.com/docs/add-services/redis.md#usage-example)
* [Solr](https://developer.upsun.com/docs/add-services/solr.md#usage-example)
* [Valkey](https://developer.upsun.com/docs/add-services/valkey.md#usage-example)
* [Varnish](https://developer.upsun.com/docs/add-services/varnish.md#usage-example)
* [Vault KMS](https://developer.upsun.com/docs/add-services/vault.md#usage-example)
* [Chroma](https://developer.upsun.com/tutorials/self-hosted/chroma.md#3-use-the-relationship-in-your-application)
* [Qdrant](https://developer.upsun.com/tutorials/self-hosted/qdrant.md#4-use-the-relationship-in-your-application)

> [!NOTE]
>
> To deploy a Java project, create a new project from the
> [Upsun Console](https://console.upsun.com/projects/create-project)
> and select a template, or push your existing code.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.