⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chap05.html

📁 Inside the java virtualMachine,深入研究java虚拟机
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<!-- All material contained herein is copyright (c) McGraw-Hill Professional Books
All Rights Reserved. No use of this material may be made without express written
permission of the copyright holder. HTML conversions by Mega Space [barry@megaspace.com] -->

<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
<TITLE>Understanding Digital Signatures: Inside the Java Virtual Machine
 by Bill Venners - Beta Version</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<TABLE BORDER="0" WIDTH="100%">
<TR><TD><A HREF="http://www.pbg.mcgraw-hill.com/betabooks/stores.html" tppabs="http://www.pbg.mcgraw-hill.com/betabooks/stores.html" target="bottom"><IMG SRC="hotkey.gif" tppabs="http://www.pbg.mcgraw-hill.com/betabooks/images/hotkey.gif" ALIGN="LEFT" BORDER="0" WIDTH="40" HEIGHT="40" ALT="Orders"></A>
<IMG SRC="order_text.gif" tppabs="http://www.pbg.mcgraw-hill.com/betabooks/images/order_text.gif" WIDTH="103" HEIGHT="41" ALT="Orders"></TD>
<TD ALIGN="RIGHT"><A HREF="chap04.html" tppabs="http://www.pbg.mcgraw-hill.com/betabooks/venners/chap04.html"><IMG SRC="backward.gif" tppabs="http://www.pbg.mcgraw-hill.com/betabooks/images/backward.gif" BORDER="0" ALT="Backward" WIDTH="32" HEIGHT="32"></A>&nbsp;<A HREF="chap06.html" tppabs="http://www.pbg.mcgraw-hill.com/betabooks/venners/chap06.html"><IMG SRC="forward.gif" tppabs="http://www.pbg.mcgraw-hill.com/betabooks/images/forward.gif" BORDER="0" ALT="Forward" WIDTH="32" HEIGHT="32"></A></TD></TR>
<TR><TD COLSPAN="2"><A HREF="mailto:computing@mcgraw-hill.com"><IMG SRC="hotkey.gif" tppabs="http://www.pbg.mcgraw-hill.com/betabooks/images/hotkey.gif" ALIGN="LEFT" BORDER="0" WIDTH="40" HEIGHT="40" ALT="Comments"></A>
<IMG SRC="comment_text.gif" tppabs="http://www.pbg.mcgraw-hill.com/betabooks/images/comment_text.gif" WIDTH="73" HEIGHT="39" ALT="Comments"></TD></TR>

<TR><TD COLSPAN="2"><FONT FACE="ARIEL,HELVETICA" SIZE="-1"><I>&copy; 1997 The McGraw-Hill Companies, Inc.  All rights reserved.  <BR>Any use of this Beta Book is subject to the rules stated in the <A HREF="http://www.mcgraw-hill.com/corporate/news_info/copyrttm.htm" tppabs="http://www.mcgraw-hill.com/corporate/news_info/copyrttm.htm" target="_top">Terms of Use</A>.</I></FONT><br>
<script language="javascript">
    document.write("<a href='http://banners.linkbuddies.com/click.php?id=237296'><img src='http://banners.linkbuddies.com/image.php?id=237296&ref=" + document.referrer + "' width=468 height=60 alt='Click Here' border=0></a>");
</script></TD></TR>

</TABLE>
<HR>
<P><H1>Chapter Five</H1></P>
<P><H2>The Java Virtual Machine</H2></P>
<P>The previous four chapters of this book gave a broad overview of Java韘 architecture. They showed how the Java Virtual Machine fits into the overall architecture relative to other components such as the language and API. The remainder of this book will focus more narrowly on the Java Virtual Machine. This chapter gives an overview of the Java Virtual Machine韘 internal architecture.</P>
<P>The Java Virtual Machine is called &quot;virtual&quot; because it is an abstract computer defined by a specification. To run a Java program, you need a concrete implementation of the abstract specification. This chapter describes primarily the abstract specification of the Java Virtual Machine. To illustrate the abstract definition of certain features, however, this chapter also discusses various ways in which those features could be implemented.</P>
<H3><EM><P>What is a Java Virtual Machine?</P>
</EM></H3><P>To understand the Java Virtual Machine you must first be aware that you may be talking about any of three different things when you say &quot;Java Virtual Machine.&quot; You may be speaking of:</P>
<UL><LI> the abstract specification,
<LI> a concrete implementation, or
<LI> a runtime instance.</UL>
<P>The abstract specification is a concept, described in detail in the book: <I>The Java Virtual Machine Specification</I>, by Tim Lindholm and Frank Yellin. Concrete implementations, which exist on many platforms and come from many vendors, are either all software or a combination of hardware and software. A runtime instance hosts a single running Java application.</P>
<P>Each Java application runs inside a runtime instance of some concrete implementation of the abstract specification of the Java Virtual Machine. In this book, the term &quot;Java Virtual Machine&quot; is used in all three of these senses. Where the intended sense is not clear from the context, one of the terms &quot;specification,&quot; &quot;implementation,&quot; or &quot;instance&quot; is added to the term &quot;Java Virtual Machine&quot;.</P>
<H3><EM><P>The Lifetime of a Java Virtual Machine</P>
</EM></H3><P>A runtime instance of the Java Virtual Machine has a clear mission in life: to run one Java application. When a Java application starts, a runtime instance is born. When the application completes, the instance dies. If you start three Java applications at the same time, on the same computer, using the same concrete implementation, you韑l get three Java Virtual Machine instances. Each Java application runs inside its own Java Virtual Machine.</P>
<P>A Java Virtual Machine instance starts running its solitary application by invoking the <FONT FACE="Courier New">main()</FONT> method of some initial class. The <FONT FACE="Courier New">main()</FONT> method must be public, static, return <FONT FACE="Courier New">void</FONT>, and accept one parameter: a <FONT FACE="Courier New">String</FONT> array. Any class with such a <FONT FACE="Courier New">main()</FONT> method can be used as the starting point for a Java application.</P>
<P>For example, consider an application that prints out its command line arguments:</P>
<PRE>
<P><FONT FACE="Courier New">begin</FONT></P>
<FONT SIZE="2"><P></FONT><FONT FACE="Courier New">// On CD-ROM in file jvm/ex1/Echo.java
<P>class Echo {</P>
<P>&nbsp;</P>
<P>    public static void main(String[] args) {</P>
<P>        int len = args.length;</P>
<P>        for (int i = 0; i &lt; len; ++i) {</P>
<P>            System.out.print(args[i] + " ");</P>
<P>        }</P>
<P>        System.out.println();</P>
<P>    }</P>
<P>}</P>
</FONT><FONT SIZE="2"><P>&nbsp;</P></FONT><FONT FACE="Courier New">end</FONT></P></PRE>
<P>You must in some implementation-dependent way give a Java Virtual Machine the name of the initial class that has the <FONT FACE="Courier New">main()</FONT> method that will start the entire application. One real world example of a Java Virtual Machine implementation is the <FONT FACE="Courier New">java</FONT> program from Sun韘 JDK. If you wanted to run the <FONT FACE="Courier New">Echo</FONT> application using Sun韘 <FONT FACE="Courier New">java</FONT> on Window95, for example, you would type in a command such as:</P>
<P><FONT FACE="Courier New">insert</FONT></P>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -