DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workkloads.

Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Java's Quiet Revolution: Thriving in the Serverless Kubernetes Era
  • Deploying Python and Java Applications to Kubernetes With Korifi
  • Kubernetes Remote Development in Java Using Kubernetes Maven Plugin
  • Java, Spring Boot, and MongoDB: Performance Analysis and Improvements

Trending

  • Docker Model Runner: Streamlining AI Deployment for Developers
  • AI Meets Vector Databases: Redefining Data Retrieval in the Age of Intelligence
  • Recurrent Workflows With Cloud Native Dapr Jobs
  • Create Your Own AI-Powered Virtual Tutor: An Easy Tutorial
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. What's New With Java 17 and Containers?

What's New With Java 17 and Containers?

Quarkus allows developers to start a new application development based on OpenJDK 17. Read the tutorial below to find out how!

By 
Daniel Oh user avatar
Daniel Oh
DZone Core CORE ·
Mar. 16, 22 · Tutorial
Likes (5)
Comment
Save
Tweet
Share
4.6K Views

Join the DZone community and get the full member experience.

Join For Free

Container platforms and edge computing continue to grow, powering major networks and applications across the globe, and Java technologies have evolved new features and improved performance to match steps with modern infrastructure. Java 17 (OpenJDK 17) was released recently (September 2021) with the following major features:

  • Restore Always-Strict Floating-Point Semantics
  • Enhanced Pseudo-Random Number Generators
  • Strongly Encapsulate JDK Internals
  • Pattern Matching for switch (Preview)
  • Foreign Function & Memory API (Incubator)
  • Vector API (Second Incubator)
  • Context-Specific Deserialization Filters

Developers are wondering how to start implementing application logic using the new features of Java 17 and then build and run them on the same OpenJDK 17 runtime. Luckily, Quarkus enables the developers to scaffold a new application with Java 17. It also provides a live coding capability that allows developers to focus only on implementing business logic instead of compiling, building, deploying, and restarting runtimes to apply code changes.

Note: If you haven’t already installed OpenJDK 17, download a binary on your operating system.

This tutorial teaches you to use the Pseudo-Random Number Generators (PRNG) algorithms of Java 17 on Quarkus. Get started by scaffolding a new project using the Quarkus command-line tool (CLI):

$ quarkus create app prng-example --java=17


The output looks like this:

...
[SUCCESS] ✅  quarkus project has been successfully generated in:
--> /Users/danieloh/quarkus-demo/prng-example
...


Unlike traditional Java frameworks, Quarkus provides live coding features for developers to rebuild and deploy while the code changes. In the end, this capability accelerates inner loop development for Java developers. Run your Quarkus application using Dev mode:

$ cd prng-example
$ quarkus dev


The output looks like this:

...
INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, resteasy, smallrye-context-propagation, vertx]

--
Tests paused
Press [r] to resume testing, [o] Toggle test output, [:] for the terminal, [h] for more options>


Java 17 enables developers to generate random integers within a specific range based on the Xoshiro256PlusPlus PRNG algorithm. Add the following code to the hello() method in the src/main/java/org/acme directory:

RandomGenerator randomGenerator = RandomGeneratorFactory.of("Xoshiro256PlusPlus").create(999);

for ( int i = 0; i < 10 ; i++) {
    int result = randomGenerator.nextInt(11);
    System.out.println(result);
}


Next, invoke the RESTful API (/hello) to confirm that random integers are generated. Execute the following cURL command line in your local terminal or access the endpoint URL using a web browser:

$ curl localhost:8080/hello


Go back to the terminal where you’re running Quarkus Dev mode. There you’ll see the following ten random numbers:

4
6
9
5
7
6
5
0
6
10


Note: You don’t need to rebuild code and restart the Java runtime at all. You’ll also see the output Hello RESTEasy in the terminal where you ran the curl command line.

To Wrap Up

This article shows how Quarkus allows developers to start a new application development based on OpenJDK 17. Furthermore, Quarkus increases developers’ productivity by live coding. For a production deployment, developers can make a native executable based on OpenJDK 17 and GraalVM.

Subscribe to bit.ly/danielohtv for learning cloud-native application development with Kubernetes.

Java (programming language) Kubernetes

Published at DZone with permission of . See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Java's Quiet Revolution: Thriving in the Serverless Kubernetes Era
  • Deploying Python and Java Applications to Kubernetes With Korifi
  • Kubernetes Remote Development in Java Using Kubernetes Maven Plugin
  • Java, Spring Boot, and MongoDB: Performance Analysis and Improvements

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!