title: How to call org.jdom.Element APIs using JNI C++
body: <p>New to JNI. I am trying to call Element::getChild and Element::getChildText APIs (java org.jdom.Element) to get the version number of a system that is stored in &quot;settings.xml&quot; This xml file is archived in JAR file. Assuming the root element is available, here is what I am doing:</p>
  <pre><code>jstring fileNameStr = env-&gt;NewStringUTF(&quot;settings.xml&quot;);
  jobject rootElement = env-&gt;CallStaticObjectMethod(a_class, xmlRootElement_mid, fileNameStr);
  
  jclass cls_element = env-&gt;FindClass(&quot;org/jdom/Element&quot;);
  
  /*get method ID for getChild() &amp; getChildText() */
  jmethodID getChild_mid = env-&gt;GetMethodID(cls_element, &quot;getChild&quot;, &quot;(Ljava/lang/String;)Lorg/jdom/Element;&quot;);
  jmethodID getChildText_mid = env-&gt;GetMethodID(cls_element, &quot;getChildText&quot;, &quot;(Ljava/lang/String;)Ljava/lang/String;&quot;);
  
  jstring aboutStr = env-&gt;NewStringUTF(&quot;about&quot;);
  jobject about = env-&gt;CallStaticObjectMethod(cls_element, getChild_mid, aboutStr); ---&gt; Seg Faults!!!
  </code></pre>
  <p>Basically, I want to do Java equivalent of this:</p>
  <pre><code>In Java:
  import org.jdom.Element;
  ...
  Element element = SomeMethodToReadXmlFile(&quot;settings.xml&quot;);
  version = element.getChild(&quot;about&quot;).getChildText(&quot;version&quot;);  &lt;---- works
  </code></pre>
  <p>How should I do this?</p>