simon_bisson
Contributor

The surprising Java support in Azure

analysis
Jun 18, 20196 mins
Cloud ComputingJavaMicrosoft Azure

Bringing Java code to Azure is a lot easier than you might think

Java / gears / moving parts working together / binary code / coding / programming / development
Credit: Shivendu Jauhari / Getty Images

Microsoft’s current developer strategy is perhaps best described as pragmatic: Meet developers where they are, not where Microsoft thinks they should be. Redmond has put aside old rivalries, open sourced its own tools and languages, shipped its own Linux kernels, and made Java a first-class citizen on Azure.

If you remember Microsoft’s acrimonious and litigious history in the late 1990s with Sun Microsystems over Java, support for Java on Azure might be surprising. But we’re living in different times, when the big public clouds aim to be home for all your code. With Amazon Web Services a clear market leader and strong competition from Google Cloud Platform, and with both treating Java as a primary development language, Azure had to give developers the same level of Java support.

Java in Visual Studio Code

At the heart of Microsoft’s strategy are its developer tools, more specifically its open source Visual Studio Code. Its extension model makes it ideal to support any language, with dictionary support for code completion and tools to integrate with build environments and support services. That extensibility framework has rapidly made it one of the more popular editors, as you can pick and choose extensions and customizations that fit it into your personal workflow.

That openness has meant support for languages that aren’t traditionally part of Microsoft’s core competency: languages such as Rust, Go, and Java. Searching for Java in the Extensions Marketplace reveals hundreds of Java tools you can use, from debuggers and language support, to test tools and integrations with popular build environments such as Maven. Microsoft bundles a selection of tools in a Java Extension pack to help you get started, but choosing and configuring extensions and themes can eat into time better spent writing code.

It’s good to see Microsoft launching a specific Visual Studio Code edition for Java developers. Building on its relationship with the OpenJDK project, and using the AdoptOpenJDK prebuilt binaries, it’s intended to be a one-stop installer for Java tools. If you don’t have Visual Studio Code installed, it’ll install a version and add Java tools as part of the install. If you’re already using it, then the installer will add the Java tools to your existing development environment. If you don’t have a JDK it’ll install the current release of OpenJDK before configuring the Java extension pack. Once it’s set up you can start building and debugging your Java apps.

Azure and other Java IDEs.

Visual Studio Code isn’t the only Java development tool Microsoft offers. If you use either Eclipse or IntelliJ, Azure toolkits add support for Azure resources and deployment without needing to change your development environment. Both support Azure sign in and use the familiar Maven build tools to build and deploy your code. There’s even support for Java in Microsoft’s Azure DevOps pipelines, so you can quickly move existing code from an on-premises repository to a cloud-hosted CI/CD pipeline.

Delivering a Java development environment is only part of Microsoft’s current Java strategy. It’s also a key development tool for Azure applications, supporting both new and existing code. Of course much of Azure’s Java support comes from its role as a host for both Linux containers and for Windows and Linux virtual machines. You can lift and shift your existing apps to Azure, choosing an appropriate VM or container for your code, and carry on building and testing apps the way you always have. The only difference is where you’re targeting your code.

Microsoft provides a set of Java SDKs for common Azure services. Although there aren’t as many as there are for .Net, they do cover common scenarios, including access to databases and storage services, as well as to Azure’s event and messaging platforms. Where SDKs aren’t available, you’re still able to use REST APIs, with tools like Postman to help construct calls and handle response JSON.

Azure Functions and Java

Existing Java skills work well with newer Azure technologies, such as Functions. Serverless code can be written using Java SE 8 LTS, with each function a public method. Microsoft provides tools to help connect Functions inputs and outputs to Java methods, including a Maven plug-in that automatically generates the JSON needed to support Functions code.

Microsoft uses Azul’s implementation of the Java 8 JDK in Functions, so if you’re planning to build and test your own local Functions implementation it’s a recommended download. That way you can experiment with customizing the underlying JVM, tuning compiler settings to improve performance and reduce latency.

Java in Service Fabric

Although much of Azure’s own tools are focused on new code, you’re able to bring existing apps to the cloud as common Java development frameworks are available in the Azure Marketplace. These include popular tools such as Pivotal’s Cloud Foundry and Red Hat’s JBoss application server. Cloud Foundry hosts the popular Spring Java development framework, and JBoss has been around for a long time, so Azure support should help with cloud migrations for existing enterprise apps. There’s even support in Azure Web Apps for the open source Tomcat application server, so you can quickly go from your IDE to a running Java-based web application.

If you’re using Spring Boot to build your Java apps you can quickly deploy them to Azure’s Service Fabric microservice framework as part of a larger application. Using command-line tools you can build your app and install a local instance of Service Fabric for testing. Spring Boot’s install tools will load code into a Service Fabric cluster and start any services that it needs. Once your code is running, Service Fabric will manage scaling, adding instances as necessary, as well as handling failover. The resulting tested code is deployed to Azure via Azure Service Fabric CLI tool (sfclt) over SSL. It connects to your Azure-hosted Service Fabric cluster before using the app’s install script to upload and install your code.

With support for Java in Service Fabric and in containers running on Azure’s managed Kubernetes instances, you’re not limited to using Azure to run existing Java code. It’s as easy to run Java microservices as it is .Net, so your existing development teams can work with modern distributed applications, building new code and updating existing apps to take advantage of Azure’s scalability and global reach.

simon_bisson
Contributor

Author of InfoWorld's Enterprise Microsoft blog, Simon BIsson prefers to think of "career" as a verb rather than a noun, having worked in academic and telecoms research, as well as having been the CTO of a startup, running the technical side of UK Online (the first national ISP with content as well as connections), before moving into consultancy and technology strategy. He’s built plenty of large-scale web applications, designed architectures for multi-terabyte online image stores, implemented B2B information hubs, and come up with next generation mobile network architectures and knowledge management solutions. In between doing all that, he’s been a freelance journalist since the early days of the web and writes about everything from enterprise architecture down to gadgets.

More from this author