Java Magazine, Sept/Oct 2018
ORACLE COM JAVAMAGAZINE SEPTEMBER OCTOBER 2018 25 the leading edge The function written in R that takes data and plots the result the source of which is located in a resource file is exposed as a Spring bean The definition takes the GraalVM context evaluates the R source and returns the result as a Java Function Double String @ Bean Function Double String getPlotFunction@ Autowired Context ctx Source source Source newBuilder R rSource getURL build return ctx eval source as Function class After that theres no diference in using the R function or any other Java functional interface implementation Similarly you can bring other languages supported by GraalVM into your Java app Conclusion In this article I looked at the GraalVM project and its components the Graal compiler Trufle and the native images utility as well as the most important API for the polyglot programs and I tried to provide a short guide on how you can get started with GraalVM Give GraalVM a try Many Java applications run faster on GraalVM many can benefit from instant startup and some perhaps can be enhanced with modules written in other supported languages such as Ruby JavaScript R and Python And if you find any issues or want to participate in this exciting project visit its Github repository article Oleg Ĺ elajev @ shelajev is a developer advocate at Oracle Labs working on GraalVM the high performance embeddable polyglot virtual machine He organizes the VirtualJUG the online Java User Group and a GDG chapter in Tartu Estonia In his spare time he is pursuing a PhD in dynamic system updates and code evolution He became a Java Champion in 2017
You must have JavaScript enabled to view digital editions.