<commit_before># How-To: Write a Java Plugin

This file serves as a tutorial on how to get started with writing a java plugin.

## Basics

If you want to know more about plugins in general, please check out the [How-To: Write a Plugin](/doc/tutorials/plugins.md) page.
If you need a tutorial for java, please check out the [How-To: Java kdb](/doc/tutorials/java-kdb.md) page.

## Two types of Java Plugins

Before we will take a look into how to write a plugin in Java, it is important to note, that there are two ways of doing that:

- using JNI plugin
- using JNA binding

If you would like to write a plugin in Java and look into the documentation, then you will definitely meet two notions like `JNI Plugin` and `JNA Binding`, so let's clarify, what they are.

### JNI Plugin

Java Native Interface is framework, which allows the Java code to execute or to be executed by the programms, written in other languages like C, C++ and Assembly. Since most of Elektra plugins are written in C and C++, the developer can use JNI plugin, which was created specifically for Elektra. This plugin allows developers to integrate Java into C code. More on JNI Plugins, you can read [here](/src/plugins/jni/README.md).

In order to use `JNI` in Elektra, the library `jni.h` must be provided for it. It is important to note, that Elektra uses SDK version 1.8, so you have to install this version of SDK and use while writing a Java plugin. This file is used later in `JNI Plugin`, which has to be enabled, while installing Elektra. More information on how to install `JNI Plugin` can be found [here](/src/plugins/jni/README.md). Please read carefully and follow instructions in `Installation` and `Enabling the Plugin` sections. If you don't have `jni.h` file, it can be easily downloaded and placed under this path:

- `/path/to/SDK/include`

or you can reinstall Java 1.8 SDK.

### JNA Binding

Java Native Access is Java technology (library), which like JNI allows a developer to run native code using only Java by providing access to native shared libraries. In order to use JNA binding, it should be firstly installed.

Generally speaking, `JNI` and `JNA` are both different java technologies that could be used to bind Java code and code written in C and C++. Even though, `JNI` gives the ability for developers to integrate Java code into C, what is not possible with `JNA`.

Here we will look into, how can we write Java Plugins using - `JNA Binding`.<commit_msg>Fix spelling<commit_after># How-To: Write a Java Plugin

This file serves as a tutorial on how to get started with writing a java plugin.

## Basics

If you want to know more about plugins in general, please check out the [How-To: Write a Plugin](/doc/tutorials/plugins.md) page.
If you need a tutorial for java, please check out the [How-To: Java kdb](/doc/tutorials/java-kdb.md) page.

## Two types of Java Plugins

Before we will take a look into how to write a plugin in Java, it is important to note, that there are two ways of doing that:

- using JNI plugin
- using JNA binding

If you would like to write a plugin in Java and look into the documentation, then you will definitely meet two notions like `JNI Plugin` and `JNA Binding`, so let's clarify, what they are.

### JNI Plugin

Java Native Interface is framework, which allows the Java code to execute or to be executed by the programms, written in other languages like C, C++ and Assembly. Since most of Elektra plugins are written in C and C++, the developer can use JNI plugin, which was created specifically for Elektra. This plugin allows developers to integrate Java into C code. More on JNI Plugins, you can read [here](/src/plugins/jni/README.md).

In order to use `JNI` in Elektra, the library `jni.h` must be provided for it. It is important to note, that Elektra uses SDK version 1.8, so you have to install this version of SDK and use while writing a Java plugin. This file is used later in `JNI Plugin`, which has to be enabled, while installing Elektra. More information on how to install `JNI Plugin` can be found [here](/src/plugins/jni/README.md). Please read carefully and follow instructions in `Installation` and `Enabling the Plugin` sections. If you don't have `jni.h` file, it can be easily downloaded and placed under this path:

- `/path/to/SDK/include`

or you can reinstall Java 1.8 SDK.

### JNA Binding

Java Native Access is Java technology (library), which like JNI allows a developer to run native code using only Java by providing access to native shared libraries. In order to use JNA binding, it should be firstly installed. More information you can find on the the GitHub [page](https://github.com/java-native-access/jna).

Generally speaking, `JNI` and `JNA` are both different java technologies that could be used to bind Java code and code written in C and C++. Even though, `JNI` gives the ability for developers to integrate Java code into C, what is not possible with `JNA`.

Here we will look into, how can we write Java Plugins using - `JNA Binding`.
{'fraction_non_alphanumeric': 0.06357114388202471, 'fraction_numerical': 0.0015942606616181746, 'mean_word_length': 4.100609756097561, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4527373', 'n_tokens_mistral': 1393, 'n_tokens_neox': 1334, 'n_words': 822}