clarify java usage

This commit is contained in:
Troy D. Hanson
2012-04-18 01:57:34 -04:00
parent 8354211c1f
commit 11a7559c18

View File

@@ -1197,9 +1197,6 @@ by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">public</span></span> <span style="font-weight: bold"><span style="color: #0000FF">class</span></span> <span style="color: #008080">TestKVJava</span> <span style="color: #FF0000">{</span>
<span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #FF0000">{</span>
System<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">loadLibrary</span></span><span style="color: #990000">(</span><span style="color: #FF0000">"KVJava"</span><span style="color: #990000">);</span>
<span style="color: #FF0000">}</span>
<span style="font-weight: bold"><span style="color: #0000FF">public</span></span> <span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #009900">void</span> <span style="font-weight: bold"><span style="color: #000000">main</span></span><span style="color: #990000">(</span><span style="color: #008080">String</span> args<span style="color: #990000">[])</span> <span style="color: #FF0000">{</span>
<span style="color: #008080">KVJava</span> kv <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #0000FF">new</span></span> <span style="font-weight: bold"><span style="color: #000000">KVJava</span></span><span style="color: #990000">(</span><span style="color: #FF0000">"spool"</span><span style="color: #990000">);</span>
<span style="color: #008080">HashMap&lt;String,String&gt;</span> h <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #0000FF">new</span></span> HashMap<span style="color: #990000">&lt;</span>String<span style="color: #990000">,</span>String<span style="color: #990000">&gt;();</span>
@@ -1208,8 +1205,11 @@ http://www.gnu.org/software/src-highlite -->
kv<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">write</span></span><span style="color: #990000">(</span>h<span style="color: #990000">);</span>
<span style="color: #FF0000">}</span>
<span style="color: #FF0000">}</span></tt></pre></div></div>
<div class="paragraph"><p>The example loads the JNI library <tt>KVJava</tt>, instantiates an object of that class, and
passes a <tt>HashMap&lt;String,String&gt;</tt> into its <tt>write</tt> method. The <tt>read</tt> method is similar:</p></div>
<div class="paragraph"><p>The example first instantiates a <tt>KVJava</tt> object. (You can copy <tt>KVJava.java</tt> from the
<tt>kvjava</tt> directory into your own source tree; this class loads the underlying JNI-based
library, which must be built and installed as described below).</p></div>
<div class="paragraph"><p>To write to the spool, pass a <tt>HashMap&lt;String,String&gt;</tt> to the <tt>write</tt> method. The <tt>read</tt>
method is similar:</p></div>
<div class="literalblock">
<div class="content">
<pre><tt>HashMap&lt;String,String&gt; m;
@@ -1222,8 +1222,8 @@ no data is currently available in the spool.</p></div>
build. After building kvspool, <tt>cd kvjava</tt> and run <tt>make</tt>. Most likely you will need to
edit the <tt>kvjava/Makefile</tt> lines where <tt>JNIINC</tt> and <tt>JNILIB</tt> are defined to make it work.
The result of compilation is <tt>libKVJava.so</tt> which must be manually copied to your choice
of library directory such as <tt>/usr/local/lib</tt> (you may also need to set <tt>LD_LIBRARY_PATH</tt>
so that the dynamic linker can find it). Finally you can run <tt>make test</tt> to try it.</p></div>
of library directory such as <tt>/usr/local/lib</tt> (You may also need to set <tt>LD_LIBRARY_PATH</tt>
so that the dynamic linker can find this shared library it at runtime).</p></div>
</div>
<div class="sect2">
<h3 id="_c_c">C/C++</h3>
@@ -1350,7 +1350,7 @@ Use JSON internally
<div id="footer">
<div id="footer-text">
Version 0.7<br />
Last updated 2012-04-03 00:01:17 EDT
Last updated 2012-04-18 01:53:03 EDT
</div>
</div>
</body>