Documentation

guides

Deploy a Java App

Deploy a Spring Boot, Quarkus, or plain Java application to Runix.

Java apps run great on Runix. Whether you're using Spring Boot, Quarkus, or a plain Java application with an embedded server, Runix detects your build tool and deploys your app automatically.

Prerequisites#

  • A Java project with pom.xml (Maven) or build.gradle (Gradle)
  • A Runix account (sign up free at runixcloud.dev)

Supported Frameworks#

FrameworkBuild ToolNotes
Spring BootMaven or GradleMost popular Java web framework
QuarkusMaven or GradleCloud-native, fast startup
Plain JavaMaven or GradleAny embedded HTTP server

Example: Spring Boot App#

Here's a minimal Spring Boot application. If you already have a Java project with a build file, skip to the configuration step.

src/main/java/com/example/demo/DemoApplication.java
java
package com.example.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@RestController
public class DemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }

    @GetMapping("/")
    public String hello() {
        return "Hello from Runix!";
    }
}

Spring Boot reads the PORT environment variable automatically via the server.port property. Add this to your application.properties:

src/main/resources/application.properties
text
server.port=${PORT:8080}

Configuration#

Run runix init and Runix detects Java from your pom.xml or build.gradle:

runix.yaml
yaml
name: my-java-app
services:
  - name: api
    type: web-service
    repo: https://github.com/yourname/my-java-app
    branch: main

How It Works#

  1. 1.Runix detects Java from your pom.xml or build.gradle
  2. 2.It identifies your build tool (Maven or Gradle) and framework
  3. 3.An AI-powered engine generates a Dockerfile with the right JDK version and build commands
  4. 4.Your app is built (mvn package or gradle build) and packaged into a container
  5. 5.The container runs your JAR file and is deployed with a public HTTPS URL

Environment Variables#

VariableSet ByDescription
PORTRunix (automatic)The port your app should listen on
JAVA_OPTSYou (optional)JVM flags like -Xmx512m for memory tuning

Maven Wrapper#

Runix looks for the Maven wrapper (mvnw) in your project root. If it's present, Runix uses it to ensure the correct Maven version. If not, it falls back to a system Maven installation.

Including the Maven wrapper in your project is recommended. It ensures consistent builds everywhere. Generate it with: mvn wrapper:wrapper


Common Issues#

Missing Maven wrapper#

If your build fails with a "mvnw not found" message, either add the Maven wrapper to your project or make sure your pom.xml is valid so Runix can use the system Maven.

bash
# Generate the Maven wrapper
mvn wrapper:wrapper

# Make sure it's executable
chmod +x mvnw

# Commit it to your repo
git add mvnw mvnw.cmd .mvn/
git commit -m "Add Maven wrapper"

Wrong Java version#

Runix reads the Java version from your pom.xml (the <java.version> or <maven.compiler.source> property). If your project needs a specific Java version, make sure it's declared in your build file.

xml
<properties>
    <java.version>21</java.version>
</properties>

App not responding (wrong port)#

Spring Boot: Add server.port=${PORT:8080} to application.properties. Quarkus: Add quarkus.http.port=${PORT:8080} to application.properties.