Oracle by Example brandingDeploy a Java Application to Oracle Cloud

section 0Before You Begin

This 15-minute tutorial shows you how to create a basic Java application on Oracle Application Container Cloud Service.


Oracle Application Container Cloud Service lets you deploy Java SE, Node.js, PHP, and Python applications to the Oracle Cloud.

What Do You Need?

section 1Create a Java Project

  1. Open a command-line window (or Terminal in Linux).
  2. Got to the directory where you want to store the project.
  3. Generate a Maven project:
    mvn archetype:generate -DarchetypeArtifactId=jersey-quickstart-grizzly2 -DarchetypeGroupId=org.glassfish.jersey.archetypes -DinteractiveMode=false -DgroupId=com.example -DartifactId=simple-service -Dpackage=com.example -DarchetypeVersion=2.25.1

section 2Prepare the Application for Cloud Deployment

  1. Open the Main class and update the BASE_URI variable to use the PORT environment variable and the host name.
    private static final Optional<String> port = Optional.ofNullable(System.getenv("PORT")); 
    public static final String BASE_URI = ""+port.orElse("8080")+"/myapp/";
  2. Add the import java.util.Optional; line.
  3. Comment the lines:
  4. Create the manifest.json file in your root directory project (at the same level as the pom.xmlfile) and add the following content:
            "majorVersion": "8"
        "command": "java -jar simple-service-1.0-SNAPSHOT-jar-with-dependencies.jar",
        "release": {
            "build": "20170113Build",
            "commit": "commitString",
            "version": "20170113Version"
        "notes": "REST app for testing"
  5. Extract the content of the file in your local system.
  6. Copy the assembly directory in the src directory.
  7. Replace the pom.xml file of your project with the pom.xml of the file.
  8. Go back to the command-line window (or Terminal in Linux), navigate to the simple-service directory, and compile and package your application.
    mvn compile package

section 3Deploy Your Application to Oracle Application Container Cloud Service

  1. Log in to Oracle Cloud at Enter your account credentials in the Identity Domain, User Name, and Password fields.
  2. In the Oracle Cloud Services dashboard, click the Action menu Menu, and select Application Container.
  3. In the Applications list view, click Create Application and select Java SE.
  4. In the Application section, enter a name for your application and click Browse.
  5. On the File Upload dialog box, select the file located in the target directory and click Open.
  6. Keep the default values in the Instances and Memory fields and click Create.
  7. Wait until the application is created. The URL is enabled when the creation is completed.
  8. Click the URL of your application and add to the end of the URL the service endpoint: myapp/myresource and press Enter.
    JavaSample application response
    Description of the illustration java-app-response.png

more informationWant to Learn More?