GraalVM for Java Developers: The Ultimate Beginner’s Guide

 

Transcript:

How to turn your Jaw project into a cool Lego construction set that will make kids envious. The answer is,  GraalVM.  GraalVM Is it just another JVM? Well, actually not. It is much more Want a performance boost? Try out grow VM JEP compiler. Want an almost instant startup? Give a try to  GraalVM native image. Want to mix and match various languages? Try out the truffle framework. In this video, we'll look at all three components and get the answers to the questions. What, why, how and where.

 GraalVM JEP compiler is a dynamic compiler written mainly in Java and based on top of Hotspot JVM, but as opposed to Hotspot C1 and C2 compilers, it includes more optimizations. More aggressive inlining data flow analysis, better escape analysis, and so on. As a result, it can provide better performance for some workloads than C one and C two compilers. You can run your code on Graal VM just like on any other JVM. No code refactoring, no incompatibilities. All dynamic features of Java are supported TCK verification, all JVM goodies, such as the variety of Garbage Collectors and so on. But your program can potentially run faster, have better throughput, and require less resources. Any limitations? Well, of course, it's not a magic pill. Some applications will have the same performance. In some cases, you may have to tune the GraalVM compiler for better results. How do you use Graal compiler? Simply download the GraalVM distribution and use it just like any other JDK to run and compile your application. Spoiler alert: there is not one but several GraalVM distributions, but I will reveal the difference later in this video. Stay tuned! Alright, we accelerated Java coup, but what if you want to write polyglot applications or run your own language on top of GraalVM?

In come the Polyglot API and the Truffle Framework. The Truffle Framework is a tool for building tools and implementations of programming languages that you can run on top of GraalVM. There are several ready implementations for GraalVM : GraalPy for Python, GraalJS, TruffleRuby, GraalWASM, and even GraalVM LLVM runtime for C and like. And you can implement your own language and truffle. How about implementing Brain____ truffle and using it in your Java app? Sounds like a cool weekend project. Well, jokes aside, truffle lets you implement various languages in one application and benefit from them all. And you can also build language agnostic tools such as profilers or debuggers. All right, but what about the polyglot API? It lets you embed code from the guest languages into a host Java application or embed Java code into the application written other languages. You can run code from any language implemented on truffle in a host Java Applic. Any limitations, traps, caveats. I know it sounds too good to be true. So here are some things to consider. Implementing your own language sounds cool, but it's not a one hour task. You get the tools, but you have to carve the sculpture yourself. Not all the tools and libraries for guest programming languages are available, but otherwise, GraalVM makes your Java app a hospitable host for any guest language.

Just don't let them quarrel our politics. Here comes the most hyped part of GraalVM. GraalVM Native Image. GraalVM native image compiles Java application at build time and turns it into a platform specific, fully compiled and optimized executable. That starts up almost instantly, so there's no warmup or memory overhead. It doesn't require a JVM to run. It has smaller footprint. And it has a smaller attack surface because all unrequired components were cut off during the compilation. Native image can be very useful in serverless environments. Last most GraalVM limitations are related to native image. It requires more effort to use a grom native ture with Java applications that rely heavily on Java dynamic features. Although it's not impossible, it means that you may have to tame a dragon or two. It may not be suitable for applications deeply tied into the JVM internals, and it is not a JVM, meaning there is no dynamic performance optimization as there is no JEP compiler at run time. There is a limited choice of garbage collectors. And you will have to get a knack for debugging and profiling native images. So how do you deal with reflection and its dynamic? Friends, you need to specify all cases of, uh, the usage of dynamic features in a special. Config file that will be read by the native image compiler. You can use the tracing agent that will track all the usages of dynamic features while you run your application in a test environment through all possible execution paths, and then it'll create a file automatically. But unfortunately, even the tracing agent may not always notice the usage of the dynamic features. What can I say? This is an exciting journey and if you really need what awaits you at the end, it is definitely worth going through. And now as promised, what is the difference between GraalVM distributions?

Cut to the Chase GraalVM community is free open source and is suitable for most use cases. Oracle GraalVM offers more optimizations, but it may not be free in some cases. Please read the license carefully. Plus, there are two downstream distributions of GraalVM Community Edition. Liberica Native Image Kit by BellSoft and Mandrel by Red Hat. Liberica Native Image Kit is recommended by Spring and is used by default in spring build pack. It also provides builds with Java effects. Manl includes only the native image part and is optimized for cos. So if you want to use a free version, but you may need technical support somewhere in the future. I suggest you try out these bad boys about the updates. Oracle GraalVM LTS is updated for free for three years and after that you have to either migrate to a newer LTS version or pay for support. GraalVM community provides updates only for the latest Java version, Liberica Native Image Kit and Mangel receive support for LTS versions for a longer period of time.

Consult their product support cycles. Let's summarize implementations applied to native image. There is no dynamic performance optimization. The choice of garbage collectors is limited, and the build process is resource and time consuming. When to use Jeep or native image. Git compiler is great for long running AppCDS and dynamic workloads. Native image is optimal for serverless computing and services characterized by short runs. Can we combine polyglot and native image? Generally? Yes, but all solutions must support a AOT mode. Sounds complicated. Well, actually it's not. Just choose a component and try it out. I hope I convinced you that grow is not just another JVM. It is a powerful solution for various engineering needs. Try out the component that best fits your needs and see it in action on your project. Don't forget to like, subscribe, and until next time.

Summary

In this video, GraalVM is presented as more than just another JVM. It offers a JIT compiler for better performance, a Polyglot API and Truffle framework for mixing languages, and a Native Image tool for creating fast, lightweight executables. While Native Image is great for serverless and short-lived apps, it has limitations like restricted dynamic features and fewer garbage collectors. GraalVM comes in different distributions such as Community, Oracle, Liberica, and Mandrel, each with its own benefits and support options.

About Catherine

Java developer passionate about Spring Boot. Writer. Developer Advocate at BellSoft

Social Media

Videos
card image
Dec 12, 2025
Will AI Replace Developers? A Vibe Coding Reality Check 2025

Can AI replace software engineers? ChatGPT, Copilot, and LLM-powered vibe coding tools promise to automate development—but after testing them against 17 years of production experience, the answer is more nuanced than the hype suggests. Full project generation produces over-engineered code that's hard to refactor. AI assistants excel at boilerplate but fail at business logic. MCP servers solve hallucination problems but create context overload. Meanwhile, DevOps automation actually works. This breakdown separates AI capabilities from marketing promises—essential for teams integrating LLMs and copilots without compromising code quality or architectural decisions.

Videos
card image
Dec 12, 2025
JRush | Container Essentials: Fast Builds, Secure Images, Zero Vulnerabilities

Web-conference for Java developers focused on hands-on strategies for building high-performance containers, eliminating CVEs, and detecting security issues before production.

Further watching

Videos
card image
Dec 30, 2025
Java in 2025: LTS Release, AI on JVM, Framework Modernization

Java in 2025 isn't about headline features, it's about how production systems changed under the hood. While release notes focus on individual JEPs, the real story is how the platform, frameworks, and tooling evolved to improve stability, performance, and long-term maintainability. In this video, we look at Java from a production perspective. What does Java 25 LTS mean for teams planning to upgrade? How are memory efficiency, startup time, and observability getting better? Why do changes like Scoped Values and AOT optimizations matter beyond benchmarks? We also cover the broader ecosystem: Spring Boot 4 and Framework 7, AI on the JVM with Spring AI and LangChain4j, Kotlin's growing role in backend systems, and tooling updates that make upgrades easier. Finally, we touch on container hardening and why runtime and supply-chain decisions matter just as much as language features.

Videos
card image
Dec 24, 2025
I Solved Advent of Code 2025 in Kotlin: Here's How It Went

Every year, Advent of Code spawns thousands of solutions — but few engineers step back to see the bigger picture. This is a complete walkthrough of all 12 days from 2025, focused on engineering patterns rather than puzzle statements. We cover scalable techniques: interval math without brute force, dynamic programming, graph algorithms (JGraphT), geometry with Java AWT Polygon, and optimization problems that need constraint solvers like ojAlgo. You'll see how Java and Kotlin handle real constraints, how visualizations validate assumptions, and when to reach for libraries instead of writing everything from scratch. If you love puzzles, programming—or both—and maybe want to learn how to solve them on the JVM, this is for you.

Videos
card image
Dec 18, 2025
Java 26 Preview: New JEPs and What They Mean for You

Java 26 is the next feature release that brings features for enhanced performance, security, and developer experience. This video discusses the upcoming JDK 26 release, highlighting ten JEPs including JEP 500. JEP 500 focuses on preparing developers for future restrictions on mutating final fields in Java, emphasizing their role in maintaining immutable state. This is crucial for robust programming and understanding the nuances of mutable vs immutable data, especially concerning an immutable class in java. We also touch upon the broader implications for functional programming in Java.