Search code examples
ballerinaballerina-java-interop

Is there a way to use a java library in my ballerina project?


Is there a way to use a java library in my ballerina project? If is there a way, how can i make it happen?


Solution

  • Yes, it is possible to use a Java library in your Ballerina project. While Ballerina is not inherently a JVM language, the current implementation, known as jBallerina, targets the Java Virtual Machine (JVM). This approach allows seamless interoperability with Java by aligning with Ballerina's language semantics. Developers can easily leverage Java libraries and invoke Java code within their Ballerina applications, extending the language's capabilities through its JVM compatibility.

    You can refer to the following documentation on how it is done, https://ballerina.io/learn/call-java-code-from-ballerina.