# Creating native image with micronaut and graalvm

In last section we saw , how easy it was to create a project with micronaut. We created our universe savior heroes and called them through our url ```/super-heroes``` with their powers .If you have not checked it, you can take a look at below link.
 [https://blog.codingsaint.com/micronaut-the-starting-your-first-project](https://blog.codingsaint.com/micronaut-the-starting-your-first-project) 

The world these days are moving at fast pace. To start our system it was taking almost 3 seconds. What if it turns out to be too much to call these saviors. Graalvm is there to rescue. We will build native images in this article and start our system in milliseconds. 
In order to build native image we require graalvm . To install graalvm on your system there are several ways , but now let's use the easy one SDKMAN. If you have not installed SDKMAN , please do it. Its awesome. 
 [https://sdkman.io/](https://sdkman.io/) 

To check list of available jdks use following command

```sdk list java```

From the list choose the graalvm 

![Screenshot from 2021-08-20 22-14-11.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1629477902787/WUNCDsqti.png)

Here we will choose ```21.2.0.r16-grl```

Use the below command to install the graalvm SDK 
```sdk install java 21.2.0.r16-grl```

Once It is installed , we need to add native image building capabilities to it.

```gu install native-image```

Now we are ready to create native images.   Use the following command

``` ./mvnw package -Dpackaging=native-image ```

*This step might take sometime depending upon you system configurations.*
Once done you will see inside target folder there will be a new native binary present . Use it to start the application
It our case application name is ```super-heroes``` so native is also named same. 
```
./target/super-heroes
```

You will see logs as following 

![Screenshot from 2021-08-20 20-40-38.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1629478623868/D8Dyz6JH-.png)

Clearly you can see it started in 64 milliseconds which is around 47 times faster than our older effort , which was at 3028 ms , below is the screenshot of running jar than binary.

![Screenshot from 2021-08-20 20-42-35.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1629478601029/KHnv02mft.png)



---
If you like my articles you can support me by sharing the articles with your friends, twitter, facebook or any other social media. You can also buy me a  coffee 
 [![output-onlinepngtools.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1629455712688/16nGo0bof.png)]( https://buymeacoffee.com/kumarpallav)         


