I came to see another use case of GraalVM and got it in explained in a very elegant way, but the bonus part of using docker to compile it just blown my mind, how I didn't think about it before? Thanks Szymon!
@szymonstepniak4 жыл бұрын
Thanks for your kind words, Sergio! I'm happy to hear you find the bonus docker part useful :) Good luck with your GraalVM experiments, and have a good day! 👍
@tunedmystic14 жыл бұрын
omg I love your background music
@szymonstepniak4 жыл бұрын
Thanks, Sandeep! I have the same feelings about it :) Have a good day!
@KieCodes4 жыл бұрын
Thank you for this well-produced video.
@szymonstepniak4 жыл бұрын
Thank you so much for the kind words and for watching it live with me today, Daniel! Have a good day, and see you soon either on here or on your KZbin channel! :D
@sbglasius3 жыл бұрын
Awesome video. This makes me want to skip /bin/bash entirely and do all my scripting in Groovy :-) I hope to see more videos from you in the future! Keep up the gr8 work!
@szymonstepniak3 жыл бұрын
Thank you so much for your kind words, Soren! I wouldn't reinvent the wheel, but having a chance to run our lovely Groovy scripts just as they were written in the natively-compiled language is such a huge boost. I hope you will find a good usage of it :) Take care, and have a good day!
@Daveooooooooooo02 ай бұрын
❤ wow so much I didn't know. You rock❤
@jarosawkonojacki5323 жыл бұрын
Great video, thank you for your work.
@szymonstepniak3 жыл бұрын
Thank you so much for your kind words, Jarosław! Take care and have a good day!
@kashyapkiran17294 жыл бұрын
excellent video :)
@szymonstepniak4 жыл бұрын
Thank you very much! :)
@TheOldCow2 жыл бұрын
Great video. We use groovy a lot for our build scripts, but we compile it to a .jar file using gradle. Is there an easy way to use gradle to automate the compilation to a native image? Maybe an idea for another video?
@szymonstepniak2 жыл бұрын
Hi Craig! Thanks for the kind words! You may want to take a look at this Gradle plugin - graalvm.github.io/native-build-tools/0.9.4/gradle-plugin.html And thanks for the suggestion - Gradle + GraalVM would be a nice topic to cover in the video! :) Take care, and have a good day!
@dragandzajic4 жыл бұрын
Excellent video! I was looking for something like this for some time now. I am playing and experimenting with jlink + package to create custom runtime and than wrapping it (as .sh or exe) so it looks like native, and all that for purpose of having JavaFX application looking like native app. Does this look like interesting idea for you to make video? Ant, thanks again for all of your videos!!!
@szymonstepniak4 жыл бұрын
Thanks for your kind words, Darko! 👍 You may want to check Gluon (gluonhq.com) - I heard about it some time ago, but never tried it myself. It seems like it comes with a Maven plugin that helps you compiling JavaFX app to the standalone native binary using GraalVM. I spend almost all-time on the server side, and it's been more than 10 years since I developed a desktop app for the last time. But who knows - maybe GraalVM and JavaFX will be a good excuse to give it a shot again somewhere in the future :) Will see, I wrote down this idea, thanks! Have a good day!
@mrozi58384 жыл бұрын
Great video. Will this also work for other JVM-based languages such as Kotlin, Scala etc?
@szymonstepniak4 жыл бұрын
Yes, absolutely! The two statically typed languages are even in a better spot. Kotlin, for instance, compiles native-image a bit faster and produces smaller size (because of the much smaller size of the library itself.) The workflow for compiling Kotlin or Scala is the same as the one I've shown for Groovy. You can give it a try if you like it :) Good luck, have a good day!
@ErixSamson Жыл бұрын
Thanks, very useful as I'm starting with Groovy and Graal. On a side note, maybe the background music level could be lower, it disturbs a little bit...
@szymonstepniak Жыл бұрын
Thank you for your kind words! Take care, and have a good day!
@dadocomm28674 жыл бұрын
Great video! Can you explain why exactly is critical to use JDK 11? What are problems with JDK 8?
@szymonstepniak4 жыл бұрын
Thanks for your kind words, Dado! The problem with GraalVM JDK 8 is that this version (at least at the time of recording this video) had unresolved issue with e.g. coercing Groovy closure into Java functional interface. It means that you can't use idiomatic Groovy syntax in some use cases, like passing a closure to a method that expects a different type that can be easily coerced when you do it in a normal Groovy runtime. This problem does not exist in the GraalVM JDK 11 variant. You can look at this Github issue for more details - github.com/oracle/graal/issues/1306 Hope it answers your question. Have a good day!
@sanjayprawat4 жыл бұрын
Nice video 👍 Today I successfully compiled a Spring WebFlux Websockets Redis app into GraalVM native image, I have been trying this since months 😅 Question: Say after you compiled into native image and you get an error saying XYX class couldn't be instantiated (probably bcoz the agent couldn't create reflect.json for it) how can se manually add the configuration for that class? In other words, say I know I'm using Reflection in class A for class B, how do I configure both these so graal native image compiler understands what to do?
@sanjayprawat4 жыл бұрын
Btw I was getting error is webjars handlers in Spring WebFlux, so I removed it and added js file link directly in html using cdn 😜
@szymonstepniak4 жыл бұрын
Thanks for the kind words, Sanjay! You can always add the B class with "allPublicMethods": true to the reflect-config.json file. I wouldn't assume that native-image-agent couldn't track this reflection - it records all reflection usages, so it would be unusual if it didn't track just a single class. Make sure that you use the same classpath setting for running application with native-image-agent, and with the native-image compiler. Maybe you missed this class in the classpath that was set for the native-image compiler. Hope it helps. Have a good day!
@sanjayprawat4 жыл бұрын
@@szymonstepniak My guess is something wrong with Spring WebHandler... Coz I remember running the agent with correct classpath and I even ran the application, played with the app, moving to all possible places while the agent was On. I fixed the problem by removing the webjars itseltf, but I'll remember your trick next time in case I get this type of error again. 👍
@MotoBoyarin4 жыл бұрын
thank you for great video! I have a question: can I use Groovy JsonBuilder or JsonSlurper with GraalVM?
@szymonstepniak4 жыл бұрын
Thanks for the kind words, Anton! It's always good to hear feedback from you :) Regarding your question - yes, you can, but not out-of-the-box. JsonBuilder requires dynamic compilation, so in this case you need to mix both compilation types, where dynamic compilation is limited to only JsonBuilder part. (The smaller dynamic scope the better for the AOT compiler.) I took JsonBuilder example from the Groovy docs and I put it into following script - gist.github.com/wololock/c9cdb28625b594c5cd19ac069a20f9c3 I also had to add "groovy-json-3.0.5.jar" to the existing classpath, and then I was able to compile native image and run it successfully. So as you can see, you can still use some dynamic features in the ahead-of-time compilation, but it requires some work to make it work. I hope it helps :) Have a good day!
@RubenKelevra4 жыл бұрын
Tried to do this with JOSM a while ago and failed miserable. This application could probably benefit a lot from a native image. Maybe you could take a look at it, if it's even possible to compile it natively? 🤔
@szymonstepniak4 жыл бұрын
Hi Ruben! I've seen somewhere on Twitter people sharing successful stories about compiling Java GUI applications to the native-image. I bet there are some examples using JavaFX (and similar) that might be helpful to understand how to do the same with JOSM. At minimum, you can run the .jar file on GraalVM OpenJDK 11 with the native-image-agent to get those configuration files created for you. Then you could try to compile it to the native-image using those files (and providing all other parameter that the regular JOSM java program takes.) It doesn't guarantee the success, but if you run into some compatibility issue, you can always create GitHub issue in oracle/graal repository - GraalVM maintainers are very eager to help people. I hope it helps. Good luck and have a good day!
@RubenKelevra4 жыл бұрын
@@szymonstepniak thanks, I will give it another spin!
@kashyapkiran17294 жыл бұрын
Hi Szymon , I have used graalvm native image in AWS lambda for Micronaut application. Lambda has cold start issue and java start up time even make it worse on top of that. Native image reduce the startup from 6 sec to 500 ms . But AWS java sdk 2 does not work with graalvm . I would like to see some application with AWS services.
@szymonstepniak4 жыл бұрын
Thanks for the insightful comment and bringing this up, Kashyap! I will be doing some Micronaut + AWS videos soon, I will take your comment into account and see if any solution to the problems you mentioned exists. Happy Friday, and talk soon!
@y.m.o61714 жыл бұрын
Nice video and content. i am wondering if there is a more accurate way to calculate the time here ?
@szymonstepniak4 жыл бұрын
Thank you for your kind words! Regarding your question - in case of this specific application (simple HTTP server), I couldn't use the "time" command like: $ time ./gttp because the process was keep running after the server was started. Just for the sake of measuring the bootstrap time, I could add a switch to kill the server right after it was started, so the "time" command could be used. However, the goals was not to measure it very precisely, but rather show the order of magnitude. And for that purpose, the "shutdown" command works just fine. Thanks for the interesting comment, and don't hesitate to ask more questions. Have a good day!
@bhawani2k134 жыл бұрын
Missed the premiere :(
@szymonstepniak4 жыл бұрын
I missed you there, Bhawani :( We will do better next time! :D