<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Chaitanya Munukutla</title>
    <description>The latest articles on DEV Community by Chaitanya Munukutla (@munukutla).</description>
    <link>https://dev.to/munukutla</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F96549%2F953b85c6-e6e3-4b9f-8a45-dadb448fb8dc.jpeg</url>
      <title>DEV Community: Chaitanya Munukutla</title>
      <link>https://dev.to/munukutla</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/munukutla"/>
    <language>en</language>
    <item>
      <title>Modern Java for the Modern Dev</title>
      <dc:creator>Chaitanya Munukutla</dc:creator>
      <pubDate>Mon, 25 May 2020 09:52:54 +0000</pubDate>
      <link>https://dev.to/munukutla/modern-java-for-the-modern-dev-5dd</link>
      <guid>https://dev.to/munukutla/modern-java-for-the-modern-dev-5dd</guid>
      <description>&lt;p&gt;This is my personal experience while trying to push Java to the edge of my requirements of a Cloud-native environment. So these were the myths that are afloat about Java (or why Java is &lt;em&gt;not&lt;/em&gt; cloud-friendly)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It is heavy&lt;/li&gt;
&lt;li&gt;It is slow&lt;/li&gt;
&lt;li&gt;It is not up-to-date&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So here is my latest attempt to burst all those myths with a tailor made stack for any future Java micro-services I develop - &lt;a href="https://openjdk.java.net/projects/jdk/11"&gt;OpenJDK11&lt;/a&gt;, &lt;a href="https://helidon.io"&gt;Helidon MP&lt;/a&gt;, &lt;a href="https://www.graalvm.org"&gt;GraalVM&lt;/a&gt;, and &lt;a href="http://podman.io"&gt;Podman&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Helidon?
&lt;/h2&gt;

&lt;p&gt;Helidon is a lightweight micro-service library for Java, which lets you write fast, lean, and scalable Java applications. It comes in two variants - Helidon SE, and Helidon MP. I'm not sure what the SE means, but I call it "Super-Efficient" - yes, it's ultra small, and ultra fast. But Helidon SE might not be for everyone since it's reactive-first, leverages the builder model everywhere possible. So it might be attractive to the Kotlin-fanatics.&lt;/p&gt;

&lt;p&gt;Helidon MP however, is what steals the show. It's standards-based, and directly inherits the &lt;a href="https://microprofile.io"&gt;Jakarta EE MicroProfile&lt;/a&gt; specification. Though it might not seem very lucrative at first, it means that your application stands on the shoulders of the enterprise giants like Oracle WebLogic, IBM WebSphere etc. Microprofile also is vendor-agnostic. So even if you start your application with Helidon MP, you can easily migrate to &lt;a href="https://openliberty.io"&gt;IBM OpenLiberty&lt;/a&gt;, &lt;a href="https://www.payara.fish/products/payara-micro"&gt;Payara Micro&lt;/a&gt; etc. It really is a commendable position taken by Oracle, IBM, Payara etc. to let developers choose the best framework for their application, instead of imposing a vendor lockdown. I assume the world does not need anymore lockdowns at this point.&lt;/p&gt;

&lt;h2&gt;
  
  
  Show me the code, duh
&lt;/h2&gt;

&lt;p&gt;Right to it. Here is my &lt;code&gt;neofetch&lt;/code&gt; output&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fLNxJfRD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/j7b7gwl0sob8q4mw8zsa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fLNxJfRD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/j7b7gwl0sob8q4mw8zsa.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And here's my Maven setup&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;Apache Maven 3.6.3 &lt;span class="o"&gt;(&lt;/span&gt;cecedd343002696d0abb50b32b541b8a6ba2883f&lt;span class="o"&gt;)&lt;/span&gt;
Maven home: /maven/current
Java version: 11.0.7, vendor: Oracle Corporation, runtime: /java/11.0.7-open
Default locale: en_US, platform encoding: UTF-8
OS name: &lt;span class="s2"&gt;"linux"&lt;/span&gt;, version: &lt;span class="s2"&gt;"5.6.14-300.fc32.x86_64"&lt;/span&gt;, &lt;span class="nb"&gt;arch&lt;/span&gt;: &lt;span class="s2"&gt;"amd64"&lt;/span&gt;, family: &lt;span class="s2"&gt;"unix"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Getting a quick Helidon MP project setup is as simple as shamelessly using their stock Maven archetype&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;mvn archetype:generate &lt;span class="nt"&gt;-DinteractiveMode&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;false&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-DarchetypeGroupId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;io.helidon.archetypes &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-DarchetypeArtifactId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;helidon-quickstart-mp &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-DarchetypeVersion&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2.0.0-M3 &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-DgroupId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;io.helidon.examples &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-DartifactId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;helidon-quickstart-mp &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-Dpackage&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;io.helidon.examples.quickstart.mp
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Next, it's time to jazz it up&lt;/p&gt;

&lt;h3&gt;
  
  
  HTTP/2 support
&lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight properties"&gt;&lt;code&gt;&lt;span class="c"&gt;## Add the following line in resources/META-INF/microprofile-config.properties
&lt;/span&gt;&lt;span class="py"&gt;server.experimental.http2.enable&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Custom JRE image
&lt;/h3&gt;

&lt;p&gt;If you've been informed of one of the awesome features included in JDK9, it's the &lt;code&gt;jlink&lt;/code&gt; utility, which creates a custom JRE image, just enough to run your Java application (works for both JAR and WAR packages!)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;mvn package &lt;span class="nt"&gt;-Pjlink-image&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Native Java application!
&lt;/h3&gt;

&lt;p&gt;Yep, not kidding. GraalVM allows you to create native Java binaries, and run them independently as shell executables.&lt;/p&gt;

&lt;p&gt;Make sure you set your &lt;code&gt;GRAALVM_HOME&lt;/code&gt; environment variable to the path of your GraalVM installation. Here's mine.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ $GRAALVM_HOME&lt;/span&gt;/bin/java &lt;span class="nt"&gt;--version&lt;/span&gt;
openjdk 11.0.7 2020-04-14
OpenJDK Runtime Environment GraalVM CE 20.1.0 &lt;span class="o"&gt;(&lt;/span&gt;build 11.0.7+10-jvmci-20.1-b02&lt;span class="o"&gt;)&lt;/span&gt;
OpenJDK 64-Bit Server VM GraalVM CE 20.1.0 &lt;span class="o"&gt;(&lt;/span&gt;build 11.0.7+10-jvmci-20.1-b02, mixed mode, sharing&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;So GraalVM is your off-the-shelf JDK, plus some awesome polyglot capabilities. For the purposes of this article, I had to install the &lt;code&gt;native-image&lt;/code&gt; extension for GraalVM&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$GRAALVM_HOME&lt;/span&gt;/bin/gu &lt;span class="nb"&gt;install &lt;/span&gt;native-image
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Next, just run Maven with the native image profile&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mvn package -Pnative-image
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;So let me tell you how thin we made the application during this process.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qdOlDwIz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/u6b9f20bnyc135sk3ddv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qdOlDwIz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/u6b9f20bnyc135sk3ddv.png" alt="Comparison of Docker image sizes"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The above images are all JakartaEE standard, Cloud-native and Kubernetes-ready! &lt;/p&gt;

&lt;p&gt;Needless to say, I'm very interested to see what future lies ahead of the MicroProfile native frameworks. Hope this post has peeked your interest in Helidon, and GraalVM. Feel free to drop your comments or any suggestions!&lt;/p&gt;

</description>
      <category>java</category>
      <category>serverless</category>
      <category>helidon</category>
      <category>graal</category>
    </item>
  </channel>
</rss>
