102 lines
6.1 KiB
HTML
102 lines
6.1 KiB
HTML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE html
|
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html lang="en-us" xml:lang="en-us">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<meta name="security" content="public" />
|
|
<meta name="Robots" content="index,follow" />
|
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
|
<meta name="DC.Type" content="reference" />
|
|
<meta name="DC.Title" content="Example: Prepare the example source code" />
|
|
<meta name="DC.Relation" scheme="URI" content="http://java.sun.com/docs/books/tutorial/native1.1/index.html" />
|
|
<meta name="DC.Relation" scheme="URI" content="rzahapaseexmpls.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="rzahapaseexmplsdownload.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="rzahapaseexmplsserver.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="rzahapaseexmpls.htm" />
|
|
<meta name="copyright" content="(C) Copyright IBM Corporation 2006" />
|
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2006" />
|
|
<meta name="DC.Format" content="XHTML" />
|
|
<meta name="DC.Identifier" content="rzahapaseexmplscompile" />
|
|
<meta name="DC.Language" content="en-us" />
|
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
|
<!-- US Government Users Restricted Rights -->
|
|
<!-- Use, duplication or disclosure restricted by -->
|
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
|
<title>Example: Prepare the example source code</title>
|
|
</head>
|
|
<body id="rzahapaseexmplscompile"><a name="rzahapaseexmplscompile"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Example: Prepare the example source code</h1>
|
|
<div><div class="section"><p>Before
|
|
moving the IBM<sup>®</sup> <span class="keyword">i5/OS™</span> PASE native method for Java™ example
|
|
to your iSeries™
|
|
server, you need to compile the source code, create a C include file, and
|
|
create a shared library object.</p>
|
|
<p>The example includes the following
|
|
C and Java source
|
|
files:</p>
|
|
<ul><li><strong>PaseExample1.c:</strong> C source code file that contains an implementation
|
|
of getStringNative(). </li>
|
|
<li><strong>PaseExample1.java:</strong> Java source code file that calls the
|
|
native getStringNative method in the C program.</li>
|
|
</ul>
|
|
<p>You use the compiled Java .class file to create a C include file,
|
|
PaseExample1.h, which contains a function prototype for the getStringNative
|
|
method contained in the C source code.</p>
|
|
<p>To prepare the example source
|
|
code on your AIX<sup>®</sup> workstation,
|
|
complete the following steps:</p>
|
|
<ol><li>Use the following command to compile the Java source code: <pre> javac PaseExample1.java</pre>
|
|
|
|
</li>
|
|
<li>Use the following command to create a C include file that contains the
|
|
native method prototypes: <pre> javah -jni PaseExample</pre>
|
|
|
|
The new C include file (PaseExample1.h) contains a function prototype for
|
|
the getStringNative method. The example C source code (PaseExample1.c)
|
|
already includes the information you would copy and modify from the C
|
|
include file to use the getStringNative method. For more information
|
|
about using JNI, see the <a href="http://java.sun.com/docs/books/tutorial/native1.1/index.html" target="_blank">Java Native Interface tutorial</a> on the Sun
|
|
Web site.</li>
|
|
<li>Use the following command to compile the C source code and create a shared
|
|
library object. <pre> xlc -G -I/usr/local/java/J1.3.0/include PaseExample1.c -o libPaseExample1.so</pre>
|
|
|
|
The new shared library object file (libPaseExample1.so) contains the native
|
|
method library "PaseExample1" that the example uses. <p><strong>Note:</strong> You
|
|
may need to change the -I option to point to the directory that contains
|
|
the correct Java native method include files (for example,
|
|
jni.h) for your AIX system.</p>
|
|
|
|
</li>
|
|
</ol>
|
|
<p>For more information about the IBM <span class="keyword">i5/OS</span> PASE
|
|
native method for Java example, see the following topics:</p>
|
|
<ul><li><a href="rzahapaseexmpls.htm">Example: IBM <span class="keyword">i5/OS</span> PASE
|
|
native method for Java</a></li>
|
|
<li><a href="rzahapaseexmplsdownload.htm">Example: Download the example
|
|
source code to your AIX workstation</a></li>
|
|
<li><a href="rzahapaseexmplsserver.htm">Example: Prepare your iSeries server</a></li>
|
|
</ul>
|
|
<p> </p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzahapaseexmpls.htm" title="The IBM i5/OS PASE native method for Java example calls an instance of a native C method that then uses Java Native Interface (JNI) to call back into Java code. Rather than accessing the string directly from Java code, the example calls a native method that then calls back into Java through JNI to get the string value.">Example: IBM i5/OS PASE native method for Java</a></div>
|
|
</div>
|
|
|
|
<div class="linklist"><strong>Collected links</strong><br />
|
|
|
|
<div><a href="http://java.sun.com/docs/books/tutorial/native1.1/index.html" target="_blank">Java Native Interface tutorial</a></div>
|
|
<div><a href="rzahapaseexmpls.htm" title="The IBM i5/OS PASE native method for Java example calls an instance of a native C method that then uses Java Native Interface (JNI) to call back into Java code. Rather than accessing the string directly from Java code, the example calls a native method that then calls back into Java through JNI to get the string value.">Example: IBM <span class="keyword">i5/OS</span> PASE
|
|
native method for Java</a></div>
|
|
<div><a href="rzahapaseexmplsdownload.htm">Example: Download the
|
|
example source code to your AIX workstation</a></div>
|
|
<div><a href="rzahapaseexmplsserver.htm">Example: Prepare your iSeries
|
|
server</a></div></div>
|
|
</div>
|
|
</body>
|
|
</html> |