title: Using Java from C++
body: <p>As a C++ developer, I occasionally come across Java libraries like <a href="http://www.itextpdf.com/" rel="noreferrer">iText</a>, <a href="http://xmlgraphics.apache.org/batik/" rel="noreferrer">Batik</a>, <a href="http://jasperforge.org/plugins/project/project_home.php?projectname=jasperreports" rel="noreferrer">JasperReports</a>, and <a href="http://www.jfree.org/jfreechart/" rel="noreferrer">JFreeChart</a>.  In each case, equivalent cross-platform C++ libraries seem to be much less mature, much more expensive, or unavailable.</p>
  
  <p>Is it practical to use these Java libraries from my C++ app for reporting, charting, and similar?  If so, what's the best approach to doing so?</p>
  
  <ul>
  <li>Use JNI to embed a JVM within my application?</li>
  <li>Use GCJ to compile the Java libraries to native code?</li>
  <li>Some other integration method that I'm not aware of?</li>
  <li>Give up, since calling a Java library from C++ would be too hard to be practical, and instead invest my efforts in finding C++ libraries?</li>
  </ul>