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

108 lines
9.3 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 virtual machine" />
<meta name="abstract" content="The Java virtual machine is a runtime environment that you can add into a web browser or any operating system, such as IBM i5/OS. The Java virtual machine runs instructions that a Java compiler generates. It consists of a bytecode interpreter and runtime that allow Java class files to run on any platform, regardless of the platform on which they were originally developed." />
<meta name="description" content="The Java virtual machine is a runtime environment that you can add into a web browser or any operating system, such as IBM i5/OS. The Java virtual machine runs instructions that a Java compiler generates. It consists of a bytecode interpreter and runtime that allow Java class files to run on any platform, regardless of the platform on which they were originally developed." />
<meta name="DC.Relation" scheme="URI" content="platform.htm" />
<meta name="DC.Relation" scheme="URI" content="appsappl.htm" />
<meta name="DC.Relation" scheme="URI" content="jarfile.htm" />
<meta name="DC.Relation" scheme="URI" content="threads.htm" />
<meta name="DC.Relation" scheme="URI" content="sunjdk.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="javavirm" />
<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 virtual machine</title>
</head>
<body id="javavirm"><a name="javavirm"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Java virtual machine</h1>
<div><p>The Java™ virtual machine is a runtime environment that you
can add into a web browser or any operating system, such as IBM<sup>®</sup> <span class="keyword">i5/OS™</span>.
The Java virtual
machine runs instructions that a Java compiler generates. It consists of
a bytecode interpreter and runtime that allow Java class files to run on any platform,
regardless of the platform on which they were originally developed.</p>
<p>The class loader and security manager, which is part of the Java runtime,
insulate code that comes from another platform. They also can restrict which
system resources each class that is loaded accesses.</p>
<div class="note"><span class="notetitle">Note:</span> Java applications
are not restricted; only applets are restricted. Applications can freely access
system resources and use native methods. Most IBM Developer Kit for Java programs
are applications.</div>
<p>You can use the Create Java Program (CRTJVAPGM) command to ensure
that the code meets the safety requirements that the Java runtime
imposes to verify the bytecodes. This includes enforcing type restrictions,
checking data conversions, ensuring that parameter stack overflows or underflows
do not occur, and checking for access violations. However, you do not need
to explicitly verify the bytecodes. If you do not use the CRTJVAPGM command
in advance, then the checks occur during the first use of a class. Once the
bytecodes are verified, the interpreter decodes the bytecodes and runs the
machine instructions that are needed to carry out the desired operations.</p>
<div class="note"><span class="notetitle">Note:</span> The <a href="#javavirm__jinterpreter">Java interpreter</a> is only used if you
specify OPTIMIZE(*INTERPRET) or INTERPRET(*YES).</div>
<p>In addition to loading and running the bytecodes, the Java virtual
machine includes a garbage collector that manages memory. <a href="gc.htm">Garbage
collection</a> runs at the same time as the loading and interpretation
of the bytecodes.</p>
<div class="section" id="javavirm__jruntimeenv"><a name="javavirm__jruntimeenv"><!-- --></a><h4 class="sectiontitle">Java runtime environment</h4><p>The Java runtime
environment starts whenever you enter the Run Java (RUNJVA) command or JAVA command on
the iSeries™ command
line. Because the Java environment is multithreaded, it is necessary to
run the Java virtual machine in a job that supports threads,
such as a batch immediate (BCI) job. As illustrated in the following figure,
after the Java virtual machine starts, additional threads may
start in the job in which the garbage collector runs.</p>
<p><strong>Figure 1: The
typical Java environment when using the RUNJVA or JAVA CL command</strong><br /><a name="javavirm__rzaha502"><!-- --></a><img id="javavirm__rzaha502" src="rzaha502.gif" alt="This graphic shows&#xA;an example of starting the Java runtime environment by using the RUNJVA or&#xA;JAVA CL command on the iSeries command line." /><br /></p>
<p>It is also
possible to start the Java runtime environment by using the <samp class="codeph">java</samp> command
in Qshell from the Qshell Interpreter. In this environment, the Qshell Interpreter
is running in a BCI job that is associated with an interactive job. The Java runtime
environment starts in the job that is running the Qshell Interpreter.</p>
<p><strong>Figure
2: The Java environment when using the java command in Qshell</strong><br /><a name="javavirm__rzaha504"><!-- --></a><img id="javavirm__rzaha504" src="rzaha504.gif" alt="This graphic shows&#xA;an example of starting the Java runtime environment by using the java command&#xA;in Qshell from the Qshell Interpreter." /><br /></p>
<p>When the Java runtime
environment starts from an interactive job, the Java Shell Display is shown. This display
provides an input line for entering data into the System.in stream, as well
as displaying data that is written to the System.out stream and System.err
stream.</p>
</div>
<div class="section" id="javavirm__jinterpreter"><a name="javavirm__jinterpreter"><!-- --></a><h4 class="sectiontitle">Java interpreter</h4><p>The Java interpreter
is the part of the Java virtual machine that interprets Java class
files for a particular hardware platform. The Java interpreter decodes each bytecode and
runs a series of machine instructions for that bytecode.</p>
<div class="p">Related topics:<ul><li><a href="jarfile.htm">Java class files</a></li>
<li></li>
</ul>
</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="platform.htm" title="The Java platform is the environment for developing and managing Java applets and applications. It consists of three primary components: the Java language, the Java packages, and the Java virtual machine.">Java platform</a></div>
</div>
<div class="relconcepts"><strong>Related concepts</strong><br />
<div><a href="appsappl.htm" title="An applet is a Java program designed to be included in an HTML Web document. You can write your Java applet and include it in an HTML page, much in the same way an image is included. When you use a Java-enabled browser to view an HTML page that contains an applet, the applet's code is transferred to your system and is run by the browser's Java virtual machine.">Java applets and applications</a></div>
<div><a href="jarfile.htm" title="A Java ARchive (JAR) file is a file format that combines many files into one. The Java environment differs from other programming environments in that the Java compiler does not generate machine code for a hardware-specific instruction set. Instead, the Java compiler converts Java source code into Java virtual machine instructions, which Java class files store. You can use JAR files to store class files. The class file does not target a specific hardware platform, but instead targets the Java virtual machine architecture.">Java JAR and class files</a></div>
<div><a href="threads.htm" title="A thread is a single independent stream that runs within a program. Java is a multithreaded programming language, so more than one thread may be running within the Java virtual machine at one time. Java threads provide a way for a Java program to perform multiple tasks at the same time. A thread is essentially a flow of control in a program.">Java threads</a></div>
<div><a href="sunjdk.htm" title="The Java Development Kit (JDK) is software that is distributed by Sun Microsystems, Inc. for Java developers. It includes the Java interpreter, Java classes, and Java development tools: compiler, debugger, disassembler, appletviewer, stub file generator, and documentation generator.">Sun Microsystems, Inc. Java Development Kit</a></div>
</div>
</div>
</body>
</html>