title: How to call c++ application in Java using JNI
body: <p>I have an existing c++ application which has a few API. I need to call those API in my Java program. I tried looking into a few sample apps online. But mostly all are creating a separate c++ application.</p>
  <p>For example, in my current c++ app there is this API to getValue(). I want to call this getValue() method in Java using JNI.</p>
  <p>This is the reference I am trying to follow.
  <a href="https://www3.ntu.edu.sg/home/ehchua/programming/java/JavaNativeInterface.html" rel="nofollow noreferrer">sample code (helloworld)</a></p>
  <p>My intention here is not to recreate the c++ application, I just want to have the JNI wrapper in between my c++ app and java program.</p>
  <p>I am really sorry if this question is kinda dumb. This is my first time creating a JNI wrapper. So my question could be kinda dumb.</p>
  <p>Currently this is how my Java code is:</p>
  <pre><code>public native void getValue();
  
  static {
      System.loadLibrary(ValueClient);
  }
  
  public static void Main(String[] args) {
      Value value= new Value();
      value.getValue();
  }
  </code></pre>
  <p>But the problem is, the main supposed to be in another java file. How can I call the getValue() api without calling this in the Main as above?</p>