Category : java-native-interface

I use C++ with NDK/JNI/CMake in my Android project. I have a struct like this: struct AppSettings { std::string scenedir; std::string outmesh; std::string dmname = "depth-L0"; std::string image = "undistorted"; std::string mask; std::string aabb; } Now, I want to use my struct and change the value of the string ‘dmname’ like this: AppSettings conf; // ..

Read more

I’m trying to run a native method that I created but when I try and run my main method I get this error and I’ve got no clue how to fix it, I 100% know my shared library is being loaded. Exception in thread "main" java.lang.UnsatisfiedLinkError: Main.C.C.change(II)J at Main.C.C.change(Native Method) at Main.C.C.main(C.java:16) Here are all ..

Read more

I’m trying to load a library called "change.dll" which sits in the same directory as my file "C.java" here’s the code of that file. package Main.C; import java.io.File; public class C { public static native long change(int width, int height); private static final String absolute = new File("resolution/C/change").getAbsolutePath(); static { System.load(absolute); } public static void ..

Read more

I have a jar file acting as a launcher (launcher.jar), it has these two classes, they describe how the application starts. And the jar file of the application itself (applet.jar) package mylauncher; public class MyClassLoader { private static ClassLoader classLoader; public MyClassLoader() { … } public Applet createApplet() throws ClassNotFoundException, InstantiationException, IllegalAccessException { Class localClass ..

Read more

So I have this c++ code I wish to implement into my java project. Function: change resolution DEVMODE devmode; devmode.dmSize = sizeof(DEVMODE); devmode.dmPelsWidth = desiredWidth; devmode.dmPelsHeight = desiredHeight; long result = ChangeDisplaySettings(&devmode, DM_PELSWIDTH || DM_PELSHEIGHT); I want to implement this into this header file I generated and into its respected function so I can use ..

Read more