June 17, 2020 By Kazuki Nobutani 3 min read

IBM Cloud offers several types of services and the IBM Cloud Foundry Platform-as-a-Service (PaaS) offering is one of the most popular and widely used.

The underlying Cloud Foundry (CF) technology allows you to deploy and run your applications without managing servers or clusters, and you can integrate CF with the IBM Cloud Continuous Delivery (CD) service to automate the building and deployment of applications. 

Goal

IBM Cloud Foundry and IBM Cloud Continuous Delivery service are two different technologies, but some users gets confused with the way they work, especially when you specify a Java version to build your applications. In this post, I will explain the differences between the two and how to manage the Java version for your build.

Prerequisites

The Java version depends on the environment

While you can dynamically specify which engine to use for Node.js in package.json, you compile and run your Java application using the Java installed on the machine. Since the space and method that Cloud Foundry and Continuous Delivery service build are different, the installed Java and ways to specify the version to use are different.

How to specify which Java version to use in Cloud Foundry

In order to specify which Java version to use in Cloud Foundry, you need to specify which buildpack to use and set which Java version to use.

First, you need to find out the available buildpacks using the ibmcloud cli:

ibmcloud cf buildpacks

Once you get the filename, research the buildpack on the internet to find out if the desired Java version is included.

Finally, you specify which version of Java to use by following the Configuration and Extension. If you’d like to specify the Open OpenJDK JRE version to run in v7, you need to run the following command:

ibmcloud cf set-env your_app_name JBP_CONFIG_OPEN_JDK_JRE '{jre: { version: 1.7.0_+ }}'

How to specify which Java version to use in Continuous Delivery

On the other hand, if you build with the Continuous Delivery service, you are not going to use buildpacks. Instead, you can use versioned base images to run pipeline jobs to make sure that you are using the specific tools, libraries, and runtimes. Versioned base images help you to make sure that the bits that make up the application and the environment that you deploy the application to are consistent. You can control when the tools, libraries, or runtimes for your application change and update them when it makes sense during the development cycle.

Again, you compile and run your Java application using the Java installed on the machine. So firstly, you need to find out which base image version has the target java version installed. Check the # java-version section in the documentation.

If you need to specify the base image version, open the Delivery Pipeline page and click the three vertical dots to access the list of options:

Then, click Configure Pipeline. In the Image version tab, select the default image version to use for all jobs in your pipeline and click Save:

What’s next?

Every time vulnerabilities are found in Java, a new version gets released with fixes. Sometimes you need time to catch up with the latest version and leave your applications running in previous versions. This technique can help you adapt changes in this rapidly evolving environment. If you have any questions or concerns, please feel free to contact IBM Cloud Support team.

Was this article helpful?
YesNo

More from Cloud

Bigger isn’t always better: How hybrid AI pattern enables smaller language models

5 min read - As large language models (LLMs) have entered the common vernacular, people have discovered how to use apps that access them. Modern AI tools can generate, create, summarize, translate, classify and even converse. Tools in the generative AI domain allow us to generate responses to prompts after learning from existing artifacts. One area that has not seen much innovation is at the far edge and on constrained devices. We see some versions of AI apps running locally on mobile devices with…

IBM Tech Now: April 8, 2024

< 1 min read - ​Welcome IBM Tech Now, our video web series featuring the latest and greatest news and announcements in the world of technology. Make sure you subscribe to our YouTube channel to be notified every time a new IBM Tech Now video is published. IBM Tech Now: Episode 96 On this episode, we're covering the following topics: IBM Cloud Logs A collaboration with IBM watsonx.ai and Anaconda IBM offerings in the G2 Spring Reports Stay plugged in You can check out the…

The advantages and disadvantages of private cloud 

6 min read - The popularity of private cloud is growing, primarily driven by the need for greater data security. Across industries like education, retail and government, organizations are choosing private cloud settings to conduct business use cases involving workloads with sensitive information and to comply with data privacy and compliance needs. In a report from Technavio (link resides outside ibm.com), the private cloud services market size is estimated to grow at a CAGR of 26.71% between 2023 and 2028, and it is forecast to increase by…

IBM Newsletters

Get our newsletters and topic updates that deliver the latest thought leadership and insights on emerging trends.
Subscribe now More newsletters