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

Fortressing the digital frontier: A comprehensive look at IBM Cloud network security services

6 min read - The cloud revolution has fundamentally transformed how businesses operate. Its superior scalability, agility and cost-effectiveness have made it the go-to platform for organizations of all sizes. However, this shift to the cloud has introduced a new landscape of ever-evolving security threats. Data breaches and cyberattacks continue to hit organizations, making robust cloud network security an absolute necessity. IBM®, a titan in the tech industry, recognizes this critical need, provides a comprehensive suite of tools and offers unmatched expertise to fortify…

How well do you know your hypervisor and firmware?

6 min read - IBM Cloud® Virtual Private Cloud (VPC) is designed for secured cloud computing, and several features of our platform planning, development and operations help ensure that design. However, because security in the cloud is typically a shared responsibility between the cloud service provider and the customer, it’s essential for you to fully understand the layers of security that your workloads run on here with us. That’s why here, we detail a few key security components of IBM Cloud VPC that aim…

New IBM study: How business leaders can harness the power of gen AI to drive sustainable IT transformation

3 min read - As organizations strive to balance productivity, innovation and environmental responsibility, the need for sustainable IT practices is even more pressing. A new global study from the IBM Institute for Business Value reveals that emerging technologies, particularly generative AI, can play a pivotal role in advancing sustainable IT initiatives. However, successful transformation of IT systems demands a strategic and enterprise-wide approach to sustainability. The power of generative AI in sustainable IT Generative AI is creating new opportunities to transform IT operations…

IBM Newsletters

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