Azul’s Platform Prime is a drop-in replacement for other TCK-tested Java runtimes. This short tutorial will demonstrate how easy it is to use Platform Prime without changing any code or recompiling your applications.
Hey, it’s Carl Dea here. I’m a developer advocate at azul.com. I’m here to show you how to run a typical Spring Boot application on the Azul Platform Prime JDK. I’m also gonna show you how to switch between two JVM versions or JDKs such as Java 11 and Java 17. This is really important because in a future tutorial, we’re going to show you how to log GC results or garbage collection logs and use a visualization tool to characterize or visualize the results. In this tutorial today we’re going to show you how to run the familiar Spring Boot app called Pet Clinic. If you’re not familiar with Pet Clinic go to github.com Spring projects slash Spring Pet Clinic. There you’ll see a project. It’ll have a Gradle build or a Maven build. In this tutorial, they’re pre-built and we’ve also installed our JDK, JDK 11 and JDK 17. Just to show you, the current version of the JDK is Java 17. They’re located in the JDKS directory, which is a temporary directory where we installed both JDK 11 and JDK 17. The project that we cloned from the Spring Boot project is the Pet Clinic app, is in that directory that you see. There, we’ve already built it using Maven, so we want to go into it. And there you’ll see the target directory, which has the jar file that was built using Maven. So to run the jar application, let’s look at the actual jar file first, just to see what it looks like. So it’s called Spring Pet Clinic 2.7.3.jar. So in order to run it, you simply use the java-jar command. It’s located in Target. And then when you run it, you’ll see a lot of logs go through. And then when you’re in development mode, you’re typically listening on port 8080. So here you just say local host and you say 8080, and here’s the web application. So we can go through some of the menu options here is find owners. You click on Find Owners and you have pagination of the owners and their pets. So you can go to page two. And over here, you can go to the veterinarians and it will show you also pagination of the veterinarian doctors. So that’s really cool. So the next thing or the next step, we’re going to switch to JDK 11. So here… we’re going to stop the application, just simply hitting Ctrl-C. Just to prove that it was actually stopped, we refresh and it’s not listening on port 8080. In order to switch between JVMs, just like our previous tutorial, we set our Java home and our path environment variables. So it’s in the home JDK S directory and then we want to switch it to Java 11. It was previously it was Java 17. So we set that and then we set the path. So we first we prepend it with Java home. slash bin, which contains all the executables for the JDK. Then we want to append the path how it was previously without it being corrupted. In the previous tutorial, we used a environment variable called temp underscore path. it just preserved the previous path. So let me clear this. And just to verify, we use Java-version again. to see that we are indeed on Java 11. So really quickly, we’re going to run the Pet Store application again. and here we can start listening on port 80 again and take a look at the browser and we should see the pages. So there you have it, a quick tutorial on how to run a Spring Boot application on the Azul Platform Prime JDK and also running it on two different versions of the JDK.