ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzaha_5.4.0.1/invocapi.htm

99 lines
6.7 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<?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="concept" />
<meta name="DC.Title" content="Java Invocation API" />
<meta name="abstract" content="The Invocation API, which is part of the Java Native Interface (JNI), allows non-Java code to create a Java virtual machine, and load and use Java classes. This function lets a multithreaded program make use of Java classes that are running in a single Java virtual machine in multiple threads." />
<meta name="description" content="The Invocation API, which is part of the Java Native Interface (JNI), allows non-Java code to create a Java virtual machine, and load and use Java classes. This function lets a multithreaded program make use of Java classes that are running in a single Java virtual machine in multiple threads." />
<meta name="DC.Relation" scheme="URI" content="jni.htm" />
<meta name="DC.Relation" scheme="URI" content="invofunc.htm" />
<meta name="DC.Relation" scheme="URI" content="multjvm.htm" />
<meta name="DC.Relation" scheme="URI" content="invapiex.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="invocapi" />
<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>Java Invocation API</title>
</head>
<body id="invocapi"><a name="invocapi"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Java Invocation API</h1>
<div><p>The Invocation API, which is part of the Java™ Native
Interface (JNI), allows non-Java code to create a Java virtual machine, and load and use Java classes.
This function lets a multithreaded program make use of Java classes
that are running in a single Java virtual machine in multiple threads.</p>
<p></p>
<p>The IBM<sup>®</sup> Developer
Kit for Java supports the Java Invocation API for the following types
of callers:</p>
<ul><li>An ILE program or service program created for <samp class="codeph">STGMDL(*SNGLVL)</samp> and <samp class="codeph">DTAMDL(*P128)</samp></li>
<li>An ILE program or service program created for <samp class="codeph">STGMDL(*TERASPACE)</samp> and <samp class="codeph">DTAMDL(*LLP64)</samp></li>
<li>An <span class="keyword">i5/OS™</span> PASE executable
created for either 32-bit or 64-bit AIX<sup>®</sup></li>
</ul>
<p>The application controls the Java virtual machine. The application can
create the Java virtual machine, call Java methods (similar to the way in which
an application calls subroutines), and destroy the Java virtual machine. Once you create the Java virtual
machine, it remains ready to run within the process until the application
explicitly destroys it. While being destroyed, the Java virtual machine performs clean-up,
such as running finalizers, ending Java virtual machine threads, and releasing Java virtual
machine resources.</p>
<p>With a Java virtual machine that is ready to run, an application
written in ILE languages, such as C and RPG, can call into the Java virtual
machine to perform any function. It also can return from the Java virtual
machine to the C application, call into the Java virtual machine again, and so on. The Java virtual
machine is created once and does not have to be re-created before calling
into the Java virtual machine to run a little or a lot of Java code.</p>
<p>When using the Invocation API to run Java programs, the destination for STDOUT
and STDERR is controlled by the use of an environment variable called QIBM_USE_DESCRIPTOR_STDIO.
If this environment variable is set to Y or I (for example, QIBM_USE_DESCRIPTOR_STDIO=Y),
the Java virtual
machine uses file descriptors for STDIN (fd 0), STDOUT (fd 1), and STDERR
(fd 2). In this case, the program must set these file descriptors to valid
values by opening them as the first three files or pipes in this job. The
first file opened in the job is given fd of 0, the second fd of 1, and third
is fd of 2. For jobs initiated with the spawn API, these descriptors can be
preassigned using a file descriptor map (see documentation on Spawn API).
If the environment variable QIBM_USE_DESCRIPTOR_STDIO is not set or is set
to any other value, file descriptors are not used for STDIN, STDOUT, or STDERR.
Instead, STDOUT and STDERR are routed to a spooled file that is owned by the
current job, and use of STDIN results in an IO exception.</p>
<p>For an example that uses the Invocation API, see <a href="invapiex.htm">Example: Java Invocation
API</a>. See <a href="invofunc.htm">Invocation API functions</a> for
details about the Invocation API functions that are supported by the IBM Developer
Kit for Java.</p>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="invofunc.htm">Invocation API functions</a></strong><br />
The IBM Developer
Kit for Java supports these Invocation API functions.</li>
<li class="ulchildlink"><strong><a href="multjvm.htm">Support for multiple Java virtual machines</a></strong><br />
Java on the iSeries™ server no longer supports creating
more than one Java virtual machine (JVM) within a single job or process.
This restriction affects only those users who create JVMs by using the Java Native
Interface Invocation (JNI) API. This change in support does not affect how
you use the java command to run your Java programs.</li>
<li class="ulchildlink"><strong><a href="invapiex.htm">Example: Java Invocation API</a></strong><br />
This example follows the standard Invocation API paradigm.</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="jni.htm" title="You should only use native methods in cases where pure Java cannot meet your programming needs.">Use the Java Native Interface for native methods</a></div>
</div>
</div>
</body>
</html>