[Java] Try Quarkus with IBM Cloud Shell

2 minute read

This article is aimed at those who are starting Quarkus from now on, using the IBM Cloud Shell provided by IBM Cloud, the procedure of First Start of Quarkus.io A guide to do it.

What is Cloud Shell

IBM Cloud Shell gives you instant access to the console from the cloud menu (icon). As of June 2020, the following features are mainly released as beta version. ・30 hours/week ・Storage 500 MB/User ・File upload and download processing ・App preview Check IBM Cloud Docs for details and the latest information image.png


The original article is this QUARKUS-CREATING YOUR FIRST APPLICATION. https://quarkus.io/get-started/ I’ve learned from this guide and edited the instructions to run the IBM Cloud Shell. This time, the scope introduced is the procedure for starting, modifying, and checking the execution results of the Quarkus application. image.png

Launch CloudShell from IBM Cloud

  • Login to the IBM Cloud. If you do not have an account, please register from here. An e-mail address is required for registration. This procedure can be performed with a lite account. (As of June 2020)
  • Start Cloud Shell. image.png ・This time, we will use 3 Sessions in Cloud Shell. Session can be added with the + button. You can use up to 5 Sessions in Cloud Shell. image.png -Session1: Quarkus environment construction ** **-Session2:curl command execution -Session3:File edit

Step1: Run the sample code

Copy each line or $ to the clipboard and paste it into Cloud Shell to proceed.

1. Git clone

git clone https://github.com/quarkusio/quarkus-quickstarts.git

2. Check disk usage



3. Create Maven Project

mvn io.quarkus:quarkus-maven-plugin:1.6.0.Final:create \
    -DprojectGroupId=org.acme \
    -DprojectArtifactId=getting-started \
    -DclassName="org.acme.getting.started.GreetingResource" \
    -D path="/hello"


4. Move the directory and check the contents

$ cd getting-started


5. Check the contents of the file

$ cat pom.xml
$ cat src/main/java/org/acme/getting/started/GreetingResource.java


  • quarkus-bom, quarkus-maven-plagin is set in the pom file. image.png *GreetingResource.java will generate code like this:

    6. Start Quarkus

    ./mvnw compile quarkus:dev:

    image.png I was able to start it! Next, add Session2.

Execute code in ####7.cUrl (Session2)

curl -w "\n" http://localhost:8080/hello

*If your session expires, restart Quarkus.

image.png “Hello” is displayed as a return value! Next, add Session3.

Step2: Modify code

1. Confirm and move the directory (Session3)

$ cd getting-started

2. Move directory, copy files, check

$ cd src/main/java/org/acme/getting/started
$ cp GreetingResource.java GreetingService.java


3. Editing file confirmation (display)

cat GreetingService.java

image.png ↓ Next, edit the contents. ↓

Editing the ####4.GreetingService file

nano GreetingService.java

(Opens the editing window) Edit (or replace) the following contents

package org.acme.getting.started;

import javax.enterprise.context.ApplicationScoped;

public class GreetingService {

    public String greeting(String name) {
        return "hello" + name;


After editing the file, click Exit → Y → To Files → GreetingService.java → Ent to close image.png Display and confirm the edited file

cat GreetingService.java

Editing the ####5.GreetingResource file Edit the GreetingResource file to the following contents by the same procedure.

$ cat GreetingResource.java
$ nano GreetingResource.java

(Opens the editing window) Edit (or replace) the following contents

package org.acme.getting.started;

import javax.inject.Inject;
import javax.ws.rs.GET;import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import org.jboss.resteasy.annotations.jaxrs.PathParam;

public class GreetingResource {

    GreetingService service;

    public String greeting(@PathParam String name) {
        return service.greeting(name);

    public String hello() {
        return "hello";

After editing the file, click Exit → Y → To Files → GreetingResource.java → Ent to close Display and confirm the edited file

cat GreetingResource.java 

6. Execute code in cUrl (Session2)

$ curl -w "\n" http://localhost:8080/hello
$ curl -w "\n" http://localhost:8080/hello/greeting/quarkus
$ curl -w "\n" http://localhost:8080/hello/greeting/'One-byte alphanumeric character string ('is unnecessary)'


That’s it for the trial of Quarkus with IBM Cloud Shell. Thank you for reading until the end. Thank you!