Code Monkey home page Code Monkey logo

javalin-jdbi-graalvm's Introduction

Javalin + GraalVM

This is a demo project with GraalVM support for building a native image of the project.

First, I will like to say that I achieve this by following the tutorial from the from GraalVM and also reviewed some sample projects that they pushed out to help developers like us.

STEPS:

  1. Ensure you have GraalVM installed on your local computer. For me, I use a Mac and was able to install it using SDKMAN. SDKMAN is a useful tool for easy management of JDKs.

curl -s "https://get.sdkman.io" | bash

  1. Install GraalVM JDK:

sdk install java 17.0.9-graal && sdk use java 17.0.9-graal

At the point of writing this, I installed GraalVM support for java17. You can read the SDKMAN documentation to find more information on how you can install a specific version.

  1. Now that you have GraalVM installed, you are ready to start tinkering.
  • Clone the project

git clone https://github.com/<project.git>

  1. CD into the project folder and compile the project to create a runnable JAR with all dependencies. Run in your terminal:

mvn clean package

  1. Run your application with the agent enabled:

mvn -Pnative -Dagent exec:exec@java-agent

The agent collects the metadata and generates the configuration files in a subdirectory of target/native/agent-output. Those files will be automatically used by the native-image tool if you pass the appropriate options.

  1. Now build a native executable with the Maven profile:

mvn -DskipTests=true -Pnative -Dagent package

When the command completes, a native executable, javalin-native, is created in the /target directory of the project and ready for use.

  1. Run the executable directly or with the Maven profile:

./target/javalin-native | mvn -Pnative exec:exec@native

Future:

  • Run tests on building native executable file

NB:

Kindly create a PR for any error fixes, improvements and updates.

javalin-jdbi-graalvm's People

Contributors

eezejiugo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.