News: 1710855008

  ARM Give a man a fire and he's warm for a day, but set fire to him and he's warm for the rest of his life (Terry Pratchett, Jingo)

Catch Java 22, available from Oracle for a limited time

(2024/03/19)


Oracle released Java 22 (JDK 22) on Tuesday, sporting a dozen new features for Java developers.

Based on OpenJDK, the open source reference implementation of the Java SE Platform Edition, the commercial Oracle JDK is offered under [1]a subscription license while OpenJDK is offered under [2]a GPL license .

JDK 22 is a Feature release, meaning Oracle will [3]support it for six months until the next Feature release. LTS releases, like JDK 21, are supported for up to eight years. The next LTS release will be Java 25, scheduled for September 2025.

[4]

Oracle says Java is the "#1 Language for today's Technology Trends" – whatever that means – and that it's the "#1 Overall Enterprise/IT Organizational use," which is also a bit vague but nonetheless plausible. Someone is using the 63 billion active Java Virtual Machines (JVMs) and 41 billion cloud-based JVMs that Oracle insists exist.

[5]

[6]

Java in less qualified contexts continues to rank among the top programming [7]languages [8]in [9]various [10]surveys , and remains a core enterprise technology despite [11]concerns [12]raised last year about [13]the cost of Oracle's licensing terms .

A [14]2024 survey [PDF] of 440 Java developers conducted by software firm Perforce found "60 percent of respondents say their companies plan to add Java developers in the coming year, and 42 percent plan to increase their Java development tool budget."

[15]

Java appears to have benefited from the industry-wide push to avoid languages without strong memory safety guarantees – [16]notably C++ – even though Java's memory safety story [17]isn't entirely spotless .

Oracle last week [18]warned that a change in macOS 14.4, [19]released by Apple on March 7, is causing Java to crash on Apple Silicon hardware.

The issue affects Java 8 through early builds of JDK 22 and there's no workaround, owing to the absence of an easy way to rollback macOS updates.

"Prior to the macOS 14.4 update, in certain circumstances, the macOS kernel would respond to these protected memory accesses by sending a signal, SIGBUS or SIGSEGV , to the process," explained Aurelio Garcia-Ribeyro, senior director of product management at Oracle.

"The process could then choose to handle the signal and continue execution. With macOS 14.4, when a thread is operating in the write mode, if a memory access to a protected memory region is attempted, macOS will send the signal SIGKILL instead."

Oracle is [20]tracking the bug and has notified Apple and OpenJDK.

Bernard Traversat, VP of development for Java, told The Register that the national push for memory safety has worked out well for the Java community.

"The US government is already now pushing people and the industry to start to adopt memory safety languages because there is so much complexity now, so much risk around data, that you really want to try to build into your programming runtime environment all the safety and control that you can," he explained, noting that memory safety is one of the reasons Java has remained so popular – particularly among enterprises.

Oracle's revised Java licensing terms 2-5x more expensive for most orgs [21]READ MORE

"And as we are getting into the world of AI now, where you would have a system that controls pretty much everything in real time very quickly, you really want to build all those systems, systems in control, in a technology that provides you the best benefits of security and memory access control."

Asked whether industry interest in AI has shaped Java development, Traversat replied that the answer is both yes and no.

"Typically what we do is when we are building on those features, it's not that we're going to say, 'Hey we're going to bring this feature just for that specific use case," he explained. "We tend to take a much more holistic view of where we see the need for development. Clearly, AI/ML is very important, but [so is] the scale of running large services."

"But you're right in the sense that some of the features that we have, especially around the memory management, starting with [22]ZGC , we know that it's going to be very important that as a class of applications that's going to want to have all their data, be able to process all this data in memory. And so the age of Petabyte systems is coming. We have customers that are deploying at terabyte scale, now multi-terabyte scale, into applications. So we know we need to push, and clearly in the age of AI ML there's going to be data, data, data, data."

[23]

Java 22 incorporates a dozen JDK Enhancement Proposals, or JEPS.

[24]Region Pinning for G1 (JEP 423) refers to the Garbage-First (G1) Garbage Collector (GC), the mechanism by which Java code frees up memory. The default garbage collection behavior for G1 is to disable garbage collection in certain critical operations, to avoid moving objects in memory and messing up associated pointers. Region pinning keeps critical objects in place while others get moved during cleanup. So this proposal means Java threads no longer have to wait for G1 garbage collection operations to complete.

Improvements in Java garbage collection from JDK 21, specifically the Z Garbage Collector, were recently adopted by Netflix, which has [25]reported a reduced computational workload as a result.

[26]Statements before super(...) (Preview) (JEP 447) offers an improvement in the way Java constructors can be invoked by allowing statements to be placed prior to the constructor invocation of its parent class.

[27]'We had to educate Oracle about our contract,' CIO says after Big Red audit

[28]March Patch Tuesday sees Hyper-V join the guest-host escape club

[29]Mamas, don't let your babies grow up to be coders, Jensen Huang warns

[30]Starting over: Rebooting the OS stack for fun and profit

[31]Foreign Function & Memory API (JEP 454) refines prior proposals in JDK 19 ( [32]JEP 424 ), JDK 20 ( [33]JEP 434 ), and JDK 21 ( [34]JEP 44 ) to implement a way for Java code to invoke foreign functions from outside the Java Virtual Machine (JVM). It's intended to be a replacement for the [35]Java Native Interface (JNI).

[36]Unnamed Variables & Patterns (JEP 456) refines [37]JEP 443 from JDK 21 to provide a way to implement unused variables and patterns in a safe way, to avoid setting off static analyzer alarm bells. Compilers, analyzers, linters, and the like tend to complain when variables are declared but never used.

[38]Class-File API (Preview) (JEP 457) presents a standard API parsing, generating, and transforming Java class files, which contain Java bytecode for the JVM.

[39]Launch Multi-File Source-Code Programs (JEP 458) amends the Java launcher's source-file mode so that it can run a program that consists of multiple Java source code files.

"With JEP 458, you just put your Java file, multiple Java files, on the Java command and automatically underneath, if you have done different javac compilations, Java will just call javac [the Java compiler] for you, and then you can run your application directly," explained Traversat.

[40]String Templates (Second Preview) ) (JEP 459) expands upon [41]JEP 430 in JDK 21 to support string templates – text strings that include values computed at run time.

[42]Vector API (Seventh Incubator) (JEP 460) provides a way to make vector calculations that compile at runtime using hardware-optimized vector instructions.

[43]Stream Gatherers (Preview) (JEP 461) makes the [44]Stream API more flexible, so streaming data pipelines can process data through custom intermediate operations.

[45]Structured Concurrency (Second Preview) (JEP 462) adds an API for structured concurrency, in an effort to promote a style of concurrent programming that eliminates thread leaks and cancellation delays. Structured concurrency handles groups of tasks in different threads as a single work unit, which makes code easier to observe.

[46]Scoped Values (Second Preview) (JEP 464) provide a safe way to share immutable data within threads and with child threads.

Finally, there's [47]Implicitly Declared Classes and Instance Main Methods (Second Preview) (JEP 463), which represents an effort to make Java more approachable for students. It allows a source file to implicitly declare a class and a main method so the programmer doesn't have to bother with what's essentially boilerplate. So Java's Hello, World! Program will have fewer lines of code.

[48]

An Oracle slide showing the simplification to Hello, World! code promised by JEP 463 – Click to enlarge

This fits with the Java community's need to bring younger programmers onboard – something that becomes more difficult if educational institutions [49]focus on other languages .

Traversat said this is part of Project Amber – a Java initiative to make the language less verbose and more approachable for beginners: "We're spending a lot of investment to try to reduce the verbosity [of Java]." ®

Get our [50]Tech Resources



[1] https://www.java.com/en/download/release_notice.jsp

[2] https://openjdk.org/legal/gplv2+ce.html

[3] https://www.oracle.com/java/technologies/java-se-support-roadmap.html

[4] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_software/front&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=2&c=2ZfnEplv6RYB9IAK2HkakvAAAAMI&t=ct%3Dns%26unitnum%3D2%26raptor%3Dcondor%26pos%3Dtop%26test%3D0

[5] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_software/front&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=4&c=44ZfnEplv6RYB9IAK2HkakvAAAAMI&t=ct%3Dns%26unitnum%3D4%26raptor%3Dfalcon%26pos%3Dmid%26test%3D0

[6] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_software/front&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=3&c=33ZfnEplv6RYB9IAK2HkakvAAAAMI&t=ct%3Dns%26unitnum%3D3%26raptor%3Deagle%26pos%3Dmid%26test%3D0

[7] https://madnight.github.io/githut/#/pull_requests/2023/4

[8] https://spectrum.ieee.org/the-top-programming-languages-2023

[9] https://www.tiobe.com/tiobe-index/

[10] https://survey.stackoverflow.co/2023/#most-popular-technologies-language-prof

[11] https://www.theregister.com/2023/02/20/gartner_java_licensing/

[12] https://www.theregister.com/2023/01/27/oracle_java_licensing_change/

[13] https://www.theregister.com/2023/07/24/oracle_java_license_terms/

[14] https://www.jrebel.com/sites/default/files/pdfs/report-jrebel-2024-dev-productivity.pdf

[15] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_software/front&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=4&c=44ZfnEplv6RYB9IAK2HkakvAAAAMI&t=ct%3Dns%26unitnum%3D4%26raptor%3Dfalcon%26pos%3Dmid%26test%3D0

[16] https://devclass.com/2024/02/27/white-house-demands-memory-safe-programming-languages-but-iso-c-group-says-its-only-part-of-solution/

[17] https://lemire.me/blog/2019/03/28/java-is-not-a-safe-language/

[18] https://blogs.oracle.com/java/post/java-on-macos-14-4

[19] https://support.apple.com/en-us/109035

[20] https://bugs.java.com/bugdatabase/view_bug?bug_id=8327860

[21] https://www.theregister.com/2023/07/24/oracle_java_license_terms/

[22] https://wiki.openjdk.org/display/zgc/Main

[23] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_software/front&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=3&c=33ZfnEplv6RYB9IAK2HkakvAAAAMI&t=ct%3Dns%26unitnum%3D3%26raptor%3Deagle%26pos%3Dmid%26test%3D0

[24] https://openjdk.org/jeps/423

[25] https://netflixtechblog.com/bending-pause-times-to-your-will-with-generational-zgc-256629c9386b

[26] https://openjdk.org/jeps/447

[27] https://www.theregister.com/2024/03/06/oracle_audits/

[28] https://www.theregister.com/2024/03/13/patch_tuesday_march_2024/

[29] https://www.theregister.com/2024/02/27/jensen_huang_coders/

[30] https://www.theregister.com/2024/02/26/starting_over_rebooting_the_os/

[31] https://openjdk.org/jeps/454

[32] https://openjdk.org/jeps/424

[33] https://openjdk.org/jeps/434

[34] https://openjdk.org/jeps/442

[35] https://docs.oracle.com/en/java/javase/21/docs/specs/jni/index.html

[36] https://openjdk.org/jeps/456

[37] https://openjdk.org/jeps/443

[38] https://openjdk.org/jeps/457

[39] https://openjdk.org/jeps/458

[40] https://openjdk.org/jeps/459

[41] https://openjdk.org/jeps/430

[42] https://openjdk.org/jeps/460

[43] https://openjdk.org/jeps/461

[44] https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/stream/package-summary.html

[45] https://openjdk.org/jeps/462

[46] https://openjdk.org/jeps/464

[47] https://openjdk.org/jeps/463

[48] https://regmedia.co.uk/2024/03/15/hello_world_java.jpg

[49] https://www.theregister.com/2017/04/24/stanford_tests_javascript_in_place_of_java/

[50] https://whitepapers.theregister.com/



What's the point?

BinkyTheMagicPaperclip

You could buy the Oracle JVM based on the open source code, and pay $180 for each and every employee, every year

orrrrr you could pay *nothing* and use the open source version, that everyone else will be using. Certainly the (fairly large) company I work for stripped Java from practically all systems as the licencing cost was significant. Am I missing something amazing ('support' ?) about the Oracle release?

On a vaguely related point I looked at CLion recently, which is also 'subscription based', but if a year's subscription is purchased you retain a 'perpetual fallback licence'. That's the way to do it.

Haven't used Java for years. When it came out it was useful, and cross platform. Used it in Jython, a few Java only programs, created a moderately complex Java object called by Coldfusion. The Enterprise APIs were interesting, if a bit slow.

Now there's a lot more cross platform frameworks, web development options, Python, Powershell, and others.

Re: What's the point?

BinkyTheMagicPaperclip

(and before anyone points it out - yes I know CLion needs (Open) java, and things such as LibreOffice also use Java, or at least they used to). However, my first choice these days would either be Python or .NET/Mono for pretty much everything from web development to scripting. If I had to do cross platform desktop client development, I doubt I'd look at Java first, but (Open) JDK would be on the list.

katrinab

Who is doing AI development in Java?

I thought Python was by far the most popular language for that, and the second place language has so small a market share to be insignificant, I'm guessing it would be something like Go, Rust, C++, maybe even Swift.

Paul Herber

I'm sure Python is the Major Major Major language for AI.

Stop right now!

trevorde

Larry has enough private jets, super yachts and Hawaiian islands

Life's the same, except for the shoes.
-- The Cars