New Cloudant Java Boilerplate on Bluemix

Share this post:

This was originally posted on the blog but we wanted to ensure it received visibility to you here. The Cloudant team is thrilled to be the data layer behind Bluemix and we’re excited to have released a new IBM Bluemix boilerplate for building apps with Java and Cloudant. Cloudant has a lot of exciting updates coming for Bluemix users in the near future. Be on the lookout for more boilerplates, features, sample apps, and tutorials.

Related | Get Started with Cloudant on Bluemix

This tutorial will walk you through getting set up on IBM Bluemix and building your first app using the new Java boilerplate.


  • You’ll need a Bluemix account. If you don’t already have one, go to and sign up in the top right corner.

  • You’ll also need to download ‘cf,’ the Bluemix command line tool. You can download it here.

  • Once you’ve signed in to Bluemix, navigate to the ‘catalog’ tab and click on the Java+Cloudant boilerplate

    Cloudant BlueMix Java Catalog

    You will then be taken to the initialization page for the boilerplate.

    Cloudant BlueMix Java Overview

    On the right-hand side you are asked to name your application. I’ve named mine “CloudantJavaTest’ so you can’t use that one, but pick something similar and then hit ‘Create.’

    Behind the scenes, Bluemix will provision space on its infrastructure for your application. The amount of space used depends on the app stack used. In this case, you will get 512MB of memory for this app. While Bluemix provisions space, Cloudant is creating a free account for you on one of our multi-tenant clusters.

    After creating your app you’ll be taken to the ‘Overview’ page where you will see your run time environment and your Cloudant instance in the ‘Development Services’ section.

    Cloudant BlueMix Java Overview

    You can easily find your Cloudant credentials by clicking ‘show credentials’ on the service tile or through VCAP_SERVICES (see below.) This Cloudant account acts like any other in that it has a username, password, and endpoint URL for its REST API. The only difference is that this account can be deleted from Bluemix if you delete your application.

    To view a quick-start guide for developing your app click the “View Guide” tab toward the top. (A fun pop-up will appear.) You will also see a link to download this app to your local machine for editing the code. The screen shot below is new, to show what it looks like in the updated Bluemix UI. So don’t be too confused if you’ve made it this far.

    Cloudant Bluemix Java Overview

    Within your application, your Cloudant credentials can be accessed through the VCAP_SERVICES environmental variable. You can see this variable in the Runtime tab

    Cloudant BlueMix Java Overview

    Within the boilerplate application code there is an example of how to access this variable in the runtime environment.

    Cloudant BlueMix Java Overview

    Once you’ve downloaded your application you can make any changes you would like to the code. When you are done, push the application back to Bluemix for building and running. To do so, you must first log in to Bluemix with cf:

    $ cf login
    > username: <USERNAME>
    > password: <PASSWORD>

    then from the root directory of your application:

    $ cf push

    This will build and push the application to Bluemix. You can visit the URL http://(yourappname) and see the example app, which is a place to upload your favorite files (I use mine for useful gifs):

    Cloudant BlueMix Java Overview

    What’s Next?

    With this boilerplate you will have all the tools for building an app within Bluemix using the Java Runtime and linking it to Cloudant.

    We have many more exciting features, boilerplates, and tutorials revolving around Cloudant and Bluemix coming this year. Do you have anything you would like to see? Let us know!

    Learn More

    More stories
    May 7, 2019

    We’ve Moved! The IBM Cloud Blog Has a New URL

    In an effort better integrate the IBM Cloud Blog with the IBM Cloud web experience, we have migrated the blog to a new URL:

    Continue reading

    May 1, 2019

    Two Tutorials: Plan, Create, and Update Deployment Environments with Terraform

    Multiple environments are pretty common in a project when building a solution. They support the different phases of the development cycle and the slight differences between the environments, like capacity, networking, credentials, and log verbosity. These two tutorials will show you how to manage the environments with Terraform.

    Continue reading

    April 29, 2019

    Transforming Customer Experiences with AI Services (Part 1)

    This is an experience from a recent customer engagement on transcribing customer conversations using IBM Watson AI services.

    Continue reading