anquegi
anquegi

Reputation: 11522

Add a folder to the java.library.path in play framework using JNI

I want to use JNI with Play framework, finally following this project https://github.com/ezh/HelloWorldJNIwithRegisterNatives I managed to build the scala wrappers and compile the code, the library generated is working, but I need to change the java.library.path to point also to target/so where de library is generated, if not I need to copy manually it to one folder that is pointed by the java.library.path

Thanks in advance

Upvotes: 2

Views: 469

Answers (1)

EnriMR
EnriMR

Reputation: 3970

Maybe this is not your perfect solution but, if you want to execute some C/C++ source code from your backend (PlayFramework) I suggest you to compile your C/C++ source code giving an interface that you can call from shell.

Mkyong have a tutorial to execute shell commands from Java code: http://www.mkyong.com/java/how-to-execute-shell-command-from-java/

p = Runtime.getRuntime().exec("host -t a " + domain);
p.waitFor();

BufferedReader reader = 
     new BufferedReader(new InputStreamReader(p.getInputStream()));

String line = "";           
while ((line = reader.readLine())!= null) {
sb.append(line + "\n");
}

Upvotes: 1

Related Questions