I am following this guide "How to Create a JNI with NetBeans":
Using the code from this SO question:
I have generated a .dll
and package file but am unsure what I do with them; how do I tell java where to find them using NetBeans?
My java code:
package addingcontrollerstogui;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class AddingControllersToGUI extends Application {
public native int intMethod(int i);
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("Sample.fxml"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
System.loadLibrary("Main");
System.out.println(new AddingControllersToGUI().intMethod(2));
}
My c code:
#include "AddingControllersToGUI.h"
jint JNICALL Java_addingcontrollerstogui_AddingControllersToGUI_intMethod
(JNIEnv * env, jobject object, jint param1) {
return param1 * param1;
}