Cannot find a Java installation on your machine
brent
HOBBYOP

3 months ago

Can't deploy my Spring Boot application. Java 17, Spring Boot 3. I have the same issue as this guy: https://station.railway.com/questions/problems-with-deploying-a-spring-boot-ap-bd2aada9. Not using a Dockerfile. Using the Railpackbuilder on the Metal build environment.

I never got this error when deploying a spring boot application. Railway was built to easily deploy your application without hassle but lately it's gotten way more issues.

Error:

Welcome to Gradle 8.10.2! Here are the highlights of this release: - Support for Java 23 - Faster configuration cache - Better configuration cache reports For more details see https://docs.gradle.org/8.10.2/release-notes.html Starting a Gradle Daemon (subsequent builds will be faster) FAILURE: Build failed with an exception. * What went wrong: Could not determine the dependencies of task ':bootJar'. > Could not resolve all dependencies for configuration ':runtimeClasspath'. > Failed to calculate the value of task ':compileJava' property 'javaCompiler'. > Cannot find a Java installation on your machine matching this tasks requirements: {languageVersion=17, vendor=any vendor, implementation=vendor-specific} for LINUX on x86_64. > No locally installed toolchains match and toolchain download repositories have not been configured.

Solved$20 Bounty

Pinned Solution

brent
HOBBYOP

3 months ago

system.properties did not work. I added a railpack.json file to the root of my project with this configuration where I tell Railpack to use java 17 instead of defaulting to java 21. Now it works.

{ "$schema": "https://schema.railpack.com", "packages": { "java": "17" }, "deploy": { "startCommand": "java $JAVA_OPTS -Dserver.port=$PORT -jar $(ls -1 build/libs/*.jar | grep -v plain | head -n 1)" } }

2 Replies

Railway
BOT

3 months ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open Railway 3 months ago


jmenichole
HOBBY

3 months ago

The build fails because Gradle is configured to use the Java Toolchain feature requiring Java 17, but the Railway Railpack build environment does not automatically provide that version. Gradle therefore cannot resolve a compatible Java installation and fails before compilation. Adding a .system.properties file with java.runtime.version=17 (or configuring nixpacks to install jdk17) ensures the correct Java runtime is available for the build.


brent
HOBBYOP

3 months ago

system.properties did not work. I added a railpack.json file to the root of my project with this configuration where I tell Railpack to use java 17 instead of defaulting to java 21. Now it works.

{ "$schema": "https://schema.railpack.com", "packages": { "java": "17" }, "deploy": { "startCommand": "java $JAVA_OPTS -Dserver.port=$PORT -jar $(ls -1 build/libs/*.jar | grep -v plain | head -n 1)" } }


Status changed to Solved brody 3 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...