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

📄 243.html

📁 Python Ebook Python&XML
💻 HTML
字号:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Robots" content="INDEX,NOFOLLOW">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<TITLE>Safari | Python Developer's Handbook -&gt; Welcome to JPython</TITLE>
<LINK REL="stylesheet" HREF="oreillyi/oreillyN.css">
</HEAD>
<BODY bgcolor="white" text="black" link="#990000" vlink="#990000" alink="#990000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<table width="100%" cellpadding=5 cellspacing=0 border=0 class="navtopbg"><tr><td><font size="1"><p class="navtitle"><a href="8.html" class="navtitle">Web Development</a> &gt; <a href="0672319942.html" class="navtitle">Python Developer's Handbook</a> &gt; <a href="241.html" class="navtitle">18. JPython</a> &gt; <span class="nonavtitle">Welcome to JPython</span></p></font></td><td align="right" valign="top" nowrap><font size="1"><a href="main.asp?list" class="safnavoff">See All Titles</a></font></td></tr></table>
<TABLE width=100% bgcolor=white border=0 cellspacing=0 cellpadding=5><TR><TD>
<TABLE border=0 width="100%" cellspacing=0 cellpadding=0><TR><td align=left width="15%" class="headingsubbarbg"><a href="242.html" title="18. JPython"><font size="1">&lt;&nbsp;BACK</font></a></td><td align=center width="70%" class="headingsubbarbg"><font size="1"><a href="popanote.asp?pubui=oreilly&bookname=0672319942&snode=243" target="_blank" title="Make a public or private annnotation">Make Note</a> | <a href="243.html" title="Use a Safari bookmark to remember this section">Bookmark</a></font></td><td align=right width="15%" class="headingsubbarbg"><a href="244.html" title="Java Integration"><font size="1">CONTINUE&nbsp;&gt;</font></a></td></TR></TABLE>
<a href="6%2F1%2F2002+6%3A24%3A10+PM.html" TABINDEX="-1"><img src=images/spacer.gif border=0 width=1 height=1></a><font color=white size=1>152015024128143245168232148039196038240039088173205162105045222218068074148024146197222</font><a href="read4.asp?bookname=0672319942&snode=243&now=6%2F1%2F2002+6%3A24%3A10+PM" TABINDEX="-1"><img src=images/spacer.gif border=0 width=1 height=1></a><br>
<FONT>
				<h3>Welcome to JPython</h3>
				<p>JPython is a Java implementation of the object-oriented scripting language called Python that has been certified as 100% pure Java. In other words, JPython does not use any of the C code of the original Python implementation. It is a version of Python that runs on top of the Java Virtual Machine. Thus, it allows you to run Python on any Java platform and enables your JPython applications to have access to any Java library that you might need.<a NAME="idx1073750599"></a>
					<a naME="idx1073750600"></A></P>

				<p>JPython offers the same language as Python, but it has a different implementation. Python is a scripting language whose interpreter is written in C, which means that this implementation is called CPython. On the other hand, JPython re-implements the Python parser and interpreter in Java. Actually, the interpreter is available as a Java application, which allows Python programs to be created and seamlessly integrated with the Java platform. Note however that both types of implementation (Python and JPython) have their own pace. Efforts are made to keep them in sync, but it is not guaranteed that this will always happen.</p>

				<p>JPython carries a license that complies with the Open Source definition. It is freely available for both commercial and non-commercial use and is distributed with source code.</p>

				<P>JPython was designed by <A NAme="idx1073750601"></a>Jim Hugunin, who is also the main author of the Numeric Python extensions. He has joined Guido at CNRI in 1998, leaving in mid-1999 to join the Xerox PARC team in California. When he left, <a name="idx1073750602"></a>Barry Warsaw took care of the JPython project, and he is the main person responsible for the project since then. Currently, JPython is maintained by Warsaw at <a name="idx1073750603"></a>BeOpen Python Labs.</p>

				<p>At the Web site, you can always obtain the latest information about this implementation and download info. In case you are interested in downloading the source code, it is available via CVS. The latest version of JPython was released in January of 2000. Check out the JPython Official Web site at</p>

				<p><a TarGet="_blank" hRef="http://www.jpython.org/">http://www.jpython.org/</a></p>

				<P>If you want to be in touch with other users, JPythoners have their own mailing list that you can use to discuss JPython, ask questions, and help other users as well. Check out the jpython-interest mailing list at</p>

				<p><a TARGet="_blank" hrEF="http://www.python.org/mailman/listinfo/jpython-interest">http://www.python.org/mailman/listinfo/jpython-interest</A>
					<A name="idx1073750604"></A>
					<A NAme="idx1073750605"></a></p>

				
					<H4>JPython Features</H4>
					<P>JPython's core is an interpreter engine, similar to CPython's, that provides support to the greater part of the Standard Python Library. JPython has a set of features that includes</P>

					<ul>
<li>
							<p>High-level built-in data types</p>

						</li>
<li>
							<p>Dynamic typing</p>

						</li>
<li>
							<p>Optional static compilation (which allows the creation of beans, applets, servlets, and so forth)</p>

						</li>
<Li>
							<p>Java classes and packages support</P>

						</li>
<lI>
							<p>A set of support libraries</p>

						</li>
<Li>
							<p>Interactive compilation direct to Java bytecodes (which enables JPython programs to run directly on a JVM, including running as applets in Web browser windows).</p>

						</LI>
</UL>
					<p>JPython uses the Java's <a naME="idx1073750606"></A>introspection mechanism to understand the contents of the package, which means that when you want to import a Java library, say something  such as</P>

					<pre>
						
import java.awt

					</pRE>

					<P>JPython first tries to find a Python package named <Tt claSS="monofont">java.</TT> And in case it doesn't find one, it uses the <a name="idx1073750607"></a>Java mechanism to search in the <tt class="monofont">CLASSPATH</tt> system variable for a <tt claSs="monofont">.class</tT> or <tt cLass="monofont">.jar</tT> file that meets the requirement.</p>

					<p>Another important aspect of JPython is that you can create JPython classes that subclass Java classes, extending JPython functionality without the need for using wrapper generators (such as SWIG

⌨️ 快捷键说明

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