TNS
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
NEW! Try Stackie AI
AI / Java

Java 22: Making Java More Attractive for AI Apps/Workloads

Oracle has released Java 22, the latest version of the popular programming language and platform, and is gearing it up for AI use cases.
Mar 21st, 2024 8:38am by
Featued image for: Java 22: Making Java More Attractive for AI Apps/Workloads
Feature image via Oracle.

Oracle has released Java 22, the latest version of the popular workhorse programming language and development platform.

Java 22 (Oracle JDK 22) delivers thousands of performance, stability, and security improvements, including 12 new JDK Enhancement Proposals (JEPs) that enhance the Java language, APIs, performance, and development tools included in the Java Development Kit (JDK).

Java and AI

Also. included in the new release are language features that better enable developers to use Java to build AI applications.

“JDK 22 will make AI deployments easier for the enterprise. One of the features that has been in development and is now final is the Foreign Function and Memory API,” Simon Ritter, deputy CTO at Azul, told The New Stack. “This is part of a larger OpenJDK project called Panama. Since this allows Java code to more easily interact with non-Java libraries, this is ideal for developing and deploying AI/ML applications, which will typically be using non-Java libraries.”

Georges Saab, senior vice president of Oracle Java Platform and chair of the OpenJDK governing board, told The New Stack that Java has continued to grow as a programming language because it has continually evolved to be suited to the particular use cases that people are most interested in solving today in software.

“We want to make sure that they naturally think of Java when it comes to that,” he said. However, “If I say AI to you, you probably go, Python. Okay, great. Why do you say Python? Well, what can we learn from that? Well, you know what Python is doing well is actually providing glue code to native libraries that are doing most of the heavy lifting for AI workloads. Okay, great. Well, why don’t you automatically think of Java there? Well, probably because Python did a bunch of work early on to make interfacing with native code and Python easier. And so a few years ago, we realized that and we started working on Panama, which is final with the Foreign Function and Memory API in JDK 22. And we want to make interfacing between native and Java easier for use cases like AI.”

To do that Oracle has to figure out a way to have a new version of Java Native Interface (JNI) that is easier to use. “Python is viewed as great for AI because there are all these native libraries that are doing the heavy lifting,” Saab said. “Why are those native libraries? Why aren’t those in Java? Well, they’re not in Java…?”

Oracle’s Working on It

Oracle has been working on this issue in different projects for various lengths of time. Many of them have been delivering or have delivered or are out to deliver into the six-month versions of Java.

And “While they’re not focused on AI, specifically, they’re focused on the kinds of use cases kinds of programming paradigms and the kinds of hardware capabilities that are coming so that each of these efforts, while focused on a specific area, holistically make Java much better for modern programming and the kinds of things that people want to do,” Saab told The New Stack.

Moreover, as one of Project Amber’s goals is native code and memory interoperability, Oracle’s Project Babylon is focused on foreign programming model interoperability and making it easier for developers to work with GPUs.

“Babylon’s primary goal is to extend the reach of Java to foreign programming models such as SQL, differentiable programming, machine learning models, and GPUs. Babylon will achieve this with an enhancement to reflective programming in Java, called code reflection,” a description of the project said.

Graphics processing units (GPUs) have become the foundation of artificial intelligence processing. In essence, they speak the language of AI to hardware. For example, Nvidia, which is holding its annual GTC conference this week, is making a killing selling GPUs to accelerate AI innovation.

“After nearly three decades, Java’s ability to support complex development tasks that span a wide range of use cases makes the platform as relevant as it has ever been,” said Arnal Dayaratna, research vice president for software development at IDC, in a statement. “Java’s versatility and comprehensive toolset enables it to support the development of production-grade, mission-critical applications at scale, which positions it as a key enabling technology for innovative use cases such as generative AI.”

Brad Shimmin, an analyst with Omdia, said it would be good to look at the bigger picture.

“If you step back a bit and look at these updates as a whole, it is clear to see a company keen to ensure the long-term value of Java, which is nearing its 30th year in production across so many diverse companies,” he said. “This focus shows up in enhancements like the introduction of a foreign function and memory API (within Project Loom), which enables Java to reach out to external applications and data in a much more performant and safe manner. Here, by not requiring developers to call external code and data without having to invoke the platform’s native interface to run that code – a process that can lead to both performance bottlenecks and stability issues.”

Supporting Developers at All Stages

Meanwhile, Oracle has added features to help with onboarding new developers. Although Java is 29 years old, with the language’s ongoing popularity in enterprises and elsewhere, new developers are adopting it all the time.

“The next generation of developers onboarding Java is a key investment area for Oracle,” Sharat Chandar, senior director of product management for the Java Platform at Oracle, told The New Stack. “The Java 22 release helps address this in what we call ‘Paving to Onramp.’ In Java 22, two key features can help new developers accelerate Java adoption, namely ‘Launch Multi-File Source-Code Programs’ (JEP 458) and ‘Implicitly Declared Classes and Instance Main Methods’ (JEP 463 in Second Preview).”

JEP 458 helps make it radically easier for new developers to run a program supplied as multiple files of Java source code, helping to avoid the need to configure complex build tool environments. JEP 463 aims to reduce the initial need to understand language features designed for large programs, thus helping make it easier for developers to build streamlined programs that eventually can be seamlessly expanded to embrace more advanced features as their skills grow.

“By delivering enhancements that streamline application development and extend Java’s reach to make it accessible to developers of all proficiency levels, Java 22 will help drive the creation of a wide range of new applications and services for organizations and developers alike,” Saab said in a statement.

“Java’s popularity as a programming language, platform, and developer community continues to grow in Morocco and the African region,” said Badr El Hourari, founder and CIO of xHub, in a statement. With Java 22, Oracle’s Java team’s focus on innovation will help the new developers adopt Java more quickly such as with JEP 463. By simplifying the language, the on-ramp to Java becomes easier for a whole new generation of programmers.

More Updates and Improvements

The latest JDK provides updates and improvements including language improvements from OpenJDK Project Amber (Statements before super[…], Unnamed Variables & Patterns, String Templates, and Implicitly Declared Classes and Instance Main Methods); enhancements from Project Panama (Foreign Function & Memory API and Vector API); features related to Project Loom (Structured Concurrency and Scoped Values); core libraries and tools capabilities (Class-File API, Launch Multi-File Source-Code Programs, and Stream Gatherers); and performance updates (Region Pinning for G1).

Meanwhile, significant updates delivered in Java 22 are:

Project Amber Features

  • JEP 447: Statements before super(…):
  • JEP 456: Unnamed Variables & Patterns
  • JEP 459: String Templates (Second Preview
  • JEP 463: Implicitly Declared Classes and Instance Main Methods (Second Preview):

Project Loom Features

  • JEP 462: Structured Concurrency (Second Preview
  • JEP 464: Scoped Values (Second Preview)

Project Panama Features

  • JEP 454: Foreign Function & Memory API
  • JEP 460: Vector API (Seventh Incubator

Core Libraries & Tools Features

  • JEP 457: Class-File API (Preview)
  • JEP 458: Launch Multi-File Source-Code Programs
  • JEP 461: Stream Gatherers (Preview)

Performance Updates

“Though JDK 22 is not a long-term support update, there is no reason not to use it in production,” Azul’s Ritter said. “Updates like string templates and Stream gatherers are appealing to developers and simply make it easier for them to do their jobs. The 6-month release cadence of Java is delivering more new features faster than we have ever seen prior to JDK 9.”

“Java 22 feels a bit like much earlier updates to the JDK platform in that Oracle has introduced an absolutely overwhelming number of enhancements across most of the company’s core enhancement projects — projects like Loom, Amber, and Panama,” Brad Shimmin, an analyst at Omdia told The New Stack.

Java Subscription

In addition to the new enhancements and features, Java 22 is supported by Java Management Service (JMS) — an Oracle Cloud Infrastructure (OCI) native service — which offers a unified console and dashboard to help organizations manage Java runtimes and applications on-premises or in any cloud.

Oracle said Java delivers increased performance, efficiency, innovation, and cost savings when deployed in the cloud on OCI, which is one of the first hyperscale clouds to support Java 22.

The Oracle Java Universal SE Subscription is a pay-as-you-go offering. It includes triage support for the entire Java portfolio, entitlement to GraalVM, the Java SE Subscription Enterprise Performance Pack, access to the advanced features of the Java Management Service, and the flexibility to upgrade at the pace of their businesses.

“It amazes me to see Java 22 bundle features for all — from students to senior developers, and from adventurous Java enthusiasts to organizations looking for stability with performance,” said Mala Gupta, Java developer advocate, JetBrains. “Java is embracing a minimalist approach by continuing to reduce ceremonies around writing initial steps of code, via instance main method and implicit classes, making it easier for folks to get started learning Java. With constructor makeover (statements before super[…]), Java has proven again that it supports responsible innovation, and relaxing language constraints that existed from Java’s version 1.0 without breaking any existing code… IntelliJ IDEA 2024.1 is ready with its support for Java 22 features to enable Java developers to use them with ease.”

JavaOne Returns

In other anticipated news, Oracle announced that the JavaOne conference will be back in 2025. The flagship event for the global Java community, JavaOne, will return to the San Francisco Bay Area in 2025. Taking place from March 17-20, 2025, in Redwood Shores, Calif., JavaOne 2025 will allow attendees to hear about the latest Java developments and interact with Oracle’s Java experts and industry luminaries.

Group Created with Sketch.
TNS owner Insight Partners is an investor in: run.ai, Class.
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.