Search code examples
javacservletswebcgi

use JNI and java servlet or CGI and C language?


I've to develop web application, I must use a C function server side, and I don t know if it is better use java servlet with JNI framework or CGI with C language. I must upload zip file, client side, and use this file with a specific C function. what is the better way?


Solution

  • To me it all depends. If this is a function that you have to use for a long time and you've got a Java environment already then it will be worth wrapping it in JNI. But if this is a single project then I'd say that if you've already got to use a C function you're just going to complicate your life by putting JNI on top of it.

    CGI is very simple to handle, even in C. JNI can be challenging and would be more so in a web environment.