aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/mozilla/projects/rhino
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/mozilla/projects/rhino')
-rw-r--r--files/zh-cn/mozilla/projects/rhino/bsf/index.html10
-rw-r--r--files/zh-cn/mozilla/projects/rhino/community/index.html24
-rw-r--r--files/zh-cn/mozilla/projects/rhino/debugger/index.html220
-rw-r--r--files/zh-cn/mozilla/projects/rhino/documentation/index.html81
-rw-r--r--files/zh-cn/mozilla/projects/rhino/download_rhino/index.html106
-rw-r--r--files/zh-cn/mozilla/projects/rhino/embedding_tutorial/index.html221
-rw-r--r--files/zh-cn/mozilla/projects/rhino/examples/index.html35
-rw-r--r--files/zh-cn/mozilla/projects/rhino/index.html22
-rw-r--r--files/zh-cn/mozilla/projects/rhino/license/index.html47
-rw-r--r--files/zh-cn/mozilla/projects/rhino/overview/index.html78
-rw-r--r--files/zh-cn/mozilla/projects/rhino/requirements_and_limitations/index.html24
-rw-r--r--files/zh-cn/mozilla/projects/rhino/scripting_java/index.html397
-rw-r--r--files/zh-cn/mozilla/projects/rhino/shell/index.html179
13 files changed, 0 insertions, 1444 deletions
diff --git a/files/zh-cn/mozilla/projects/rhino/bsf/index.html b/files/zh-cn/mozilla/projects/rhino/bsf/index.html
deleted file mode 100644
index 8cf8b6c13e..0000000000
--- a/files/zh-cn/mozilla/projects/rhino/bsf/index.html
+++ /dev/null
@@ -1,10 +0,0 @@
----
-title: BSF
-slug: Mozilla/Projects/Rhino/BSF
-translation_of: Mozilla/Projects/Rhino/BSF
----
-<h2 id="BSF是什么">BSF是什么?</h2>
-<p><a class="ex-ref external" href="http://jakarta.apache.org/bsf/"><dfn>Bean Scripting Framework (BSF)</dfn></a>起初被IBM开发,后来作为Apache Software Foundation开源代码的一部分.它为Java上的大量的脚本语言提供了一个框架,Rhino是被支持的语言之一.</p>
-<p>这个框架已被大量的开源项目嵌入代码中, 包括 XSL 处理器 <a class="ex-ref external" href="http://xml.apache.org/xalan-j/">Xalan</a> 和  XML/Java 构建工具 <a class="ex-ref external" href="http://ant.apache.org/">Ant</a>. 查看 <a class="ex-ref external" href="http://xml.apache.org/xalan-j/extensions.html">Xalan-Java Extensions</a> 可以获取更多关于把JavaScript添加至XSL、在<a class="ex-ref external" href="http://ant.apache.org/manual/">Apache Ant Manual</a>中使用脚本构建项目时脚本任务的命令项的描述等信息.</p>
-<h2 id="Using_BSF_with_Rhino">Using BSF with Rhino</h2>
-<p>Now that the Apache Jakarta <dfn>Bean Scripting Framework (BSF)</dfn>, version 2.4.0, has been officially released, you can use Rhino easily with BSF. See <a class="ex-ref external" href="http://jakarta.apache.org/bsf/index.html">http://jakarta.apache.org/bsf/index.html</a>.</p>
diff --git a/files/zh-cn/mozilla/projects/rhino/community/index.html b/files/zh-cn/mozilla/projects/rhino/community/index.html
deleted file mode 100644
index 8d5c3a446c..0000000000
--- a/files/zh-cn/mozilla/projects/rhino/community/index.html
+++ /dev/null
@@ -1,24 +0,0 @@
----
-title: Rhino社区
-slug: Mozilla/Projects/Rhino/Community
-translation_of: Mozilla/Projects/Rhino/Community
----
-<p>是否有在<a href="https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino/Documentation">Rhino文档</a>中找不到解答的问题?下面这些资源可以给你一些帮助:</p>
-
-<h4 id="Newsgroup_and_Mail_Gateway" name="Newsgroup_and_Mail_Gateway">邮件列表</h4>
-
-<p>在Google讨论组中有一个叫<a href="https://groups.google.com/group/mozilla-rhino">mozilla-rhino</a>的讨论组,可以讨论Rhino相关的话题.</p>
-
-<p>还有一个比较老的讨论组叫<a href="news://news.mozilla.org/mozilla.dev.tech.js-engine.rhino">mozilla.dev.tech.js-engine.rhino</a>,已经很久没有维护了,请使用新的讨论组,但是这个老的组可能也包含一些比较有历史意义的讨论,可以去参考浏览一下.</p>
-
-<p><a class="link-news" href="news://news.mozilla.org/mozilla.dev.tech.js-engine">mozilla.dev.tech.js-engine</a>这个讨论组讨论的是关于使用C语言实现的Javascript,也有在2007年9月27日之前关于Rhino的讨论.要看在2007年9月27日之前的讨论,请移步一个叫<a class="external" href="http://groups.google.com/group/mozilla.dev.tech.js-engine/topics">Google group for the earlier newsgroup</a>的Google讨论组.</p>
-
-<h4 id="Bug_System" name="Bug_System">Bug 系统</h4>
-
-<p>最好的提交Rhino bug的方式是在Rhino的<a href="https://github.com/mozilla/rhino/issues">Github</a>中提交.</p>
-
-<p>如果你愿意解决一些提交的Bug,我们非常欢迎您解决她,并提交一个<a href="https://github.com/mozilla/rhino/pulls">pull请求</a>.</p>
-
-<p>许多老的Rhino的问题都被记录在<a class="link-https" href="https://bugzilla.mozilla.org/enter_bug.cgi?product=Rhino">Bugzilla</a>中.也许有一些比较有历史意义的bug. 最后注意Rhino有自己的产品类目.</p>
-
-<p>{{ languages( { "ja": "ja/Rhino_help" } ) }}</p>
diff --git a/files/zh-cn/mozilla/projects/rhino/debugger/index.html b/files/zh-cn/mozilla/projects/rhino/debugger/index.html
deleted file mode 100644
index 8b5ab147ca..0000000000
--- a/files/zh-cn/mozilla/projects/rhino/debugger/index.html
+++ /dev/null
@@ -1,220 +0,0 @@
----
-title: Rhino Debugger
-slug: Mozilla/Projects/Rhino/Debugger
-translation_of: Mozilla/Projects/Rhino/Debugger
----
-<p>The Rhino JavaScript debugger is a GUI that allows debugging of interpreted JavaScript scripts run in Rhino. Note that this debugger <strong>will not</strong> work with JavaScript scripts run in the mozilla browser since Rhino is not the engine used in such environments.</p>
-<p><img alt="" height="460" src="jsdebug.jpg" width="600"></p>
-<p>Current limitations:</p>
-<ul>
- <li>No breakpoint menu</li>
-</ul>
-<h2 id="Using_the_Rhino_JavaScript_Debugger">Using the Rhino JavaScript Debugger</h2>
-<p>The Mozilla Rhino JavaScript engine includes a source-level debugger for debugging JavaScript scripts. The debugger is itself a Java program which you may run as</p>
-<pre class="code" style="white-space: -moz-pre-wrap; white-space: pre-wrap;">java org.mozilla.javascript.tools.debugger.Main [options] [filename.js] [script-arguments]
-
-</pre>
-<p>where the options are the same as the shell.</p>
-<p>The Rhino JavaScript Debugger can debug scripts running in multiple threads and provides facilities to set and clear breakpoints, control execution, view variables, and evaluate arbitrary JavaScript code in the current scope of an executing script.</p>
-<dl>
- <dt>
- <a id="console" name="console">Console Window</a></dt>
- <dd>
- The debugger redirects the System.out, System.in, and System.err streams to an internal JavaScript console window which provides an editable command line for you to enter JavaScript code and view system output. The console window maintains a history of the commands you have entered. You may move backward and forward through the history list by pressing the Up/Down arrow keys on the keyboard.</dd>
- <dt>
- <a id="opening" name="opening">Opening Scripts</a></dt>
- <dd>
- You may select the <b>
- <i>
- File-&gt;Open</i>
- </b> menu item on the menu bar to load JavaScript scripts contained in files. This action will display a file-selection dialog box prompting you for the location of a script to load. The selected file will be compiled and displayed in a new window.</dd>
- <dt>
- <a id="running" name="running">Running Scripts</a></dt>
- <dd>
- You may select the <b>
- <i>
- File-&gt;Run</i>
- </b> menu item on the menu bar to execute JavaScript scripts contained in files. This action will display a file-selection dialog box prompting you for the location of a script to execute. The loaded script will be run in a new thread and control will be given to the debugger on its first instruction.</dd>
-</dl>
-<h2 id="Controlling_Execution">Controlling Execution</h2>
-<p>The debugger provides the following facilities for you to control the execution of scripts you are debugging:</p>
-<dl>
- <dt>
- <a id="stepinto" name="stepinto">Step Into</a></dt>
- <dd>
- To single step entering any function calls, you may do any of the following:
- <ul>
- <li>Select the <b>
- <i>
- Debug-&gt;Step Into</i>
- </b>menu item on the menu bar</li>
- <li>Press the <b>
- <i>
- Step Into</i>
- </b> button on the toolbar</li>
- <li>Press the F11 key on the keyboard</li>
- </ul>
- <p>Execution will resume. If the current line in the script contains a function call control will return to the debugger upon entry into the function. Otherwise control will return to the debugger at the next line in the current function.</p>
- </dd>
- <dt>
- <a id="stepover" name="stepover">Step Over</a></dt>
- <dd>
- To single step to the next line in the current function, you may do any of the following:
- <ul>
- <li>Select the <b>
- <i>
- Debug-&gt;Step Over</i>
- </b> menu item on the menu bar</li>
- <li>Press the <b>
- <i>
- Step Over</i>
- </b> button on the toolbar</li>
- <li>Press the F7 key on the keyboard</li>
- </ul>
- <p>Execution will resume but control will return to the debugger at the next line in the current function or top-level script.</p>
- </dd>
- <dt>
- <a id="stepout" name="stepout">Step Out</a></dt>
- <dd>
- To continue execution until the current function returns you may do any of the following:
- <ul>
- <li>Select the <b>
- <i>
- Debug-&gt;Step Out</i>
- </b> menu item on the menu bar</li>
- <li>Press the <b>
- <i>
- Step Out</i>
- </b> button on the toolbar</li>
- <li>Press the F8 key on the keyboard</li>
- </ul>
- <p>Execution will resume until the current function returns or a breakpoint is hit.</p>
- </dd>
- <dt>
- <a id="go" name="go">Go</a></dt>
- <dd>
- To resume execution of a script you may do any of the following:
- <ul>
- <li>Select the <b>
- <i>
- Debug-&gt;Go</i>
- </b> menu item on the menu bar</li>
- <li>Press the <b>
- <i>
- Go</i>
- </b> button on the toolbar</li>
- <li>Press the F5 key on the keyboard</li>
- </ul>
- <p>Execution will resume until a breakpoint is hit or the script completes.</p>
- </dd>
- <dt>
- <a id="break" name="break">Break</a></dt>
- <dd>
- To stop all running scripts and give control to the debugger you may do any of the following:
- <ul>
- <li>Select the <b>
- <i>
- Debug-&gt;Break</i>
- </b> menu item on the menu bar</li>
- <li>Press the <b>
- <i>
- Break</i>
- </b> button on the toolbar</li>
- <li>Press the Pause/Break key on the keyboard</li>
- </ul>
- </dd>
- <dt>
- Break on Exceptions</dt>
- <dd>
- To give control to the debugger whenever a JavaScript is exception is thrown select the <b>
- <i>
- Debug-&gt;Break on Exceptions</i>
- </b> checkbox from the menu bar. Whenever a JavaScript exception is thrown by a script a message dialog will be displayed and control will be given to the debugger at the location the exception is raised.</dd>
- <dt>
- Break on Function Enter</dt>
- <dd>
- Selecting <b>
- <i>
- Debug-&gt;Break on Function Enter</i>
- </b> will give control to the debugger whenever the execution is entered into a function or script.</dd>
- <dt>
- Break on Function Exit</dt>
- <dd>
- Selecting <b>
- <i>
- Debug-&gt;Break on Function Return</i>
- </b> will give control to the debugger whenever the execution is about to return from a function or script.</dd>
- <dt>
- Moving Up and Down the Stack</dt>
- <dd>
- The lower-left (dockable) pane in the debugger main window contains a combo-box labeled "Context:" which displays the current stack of the executing script. You may move up and down the stack by selecting an entry in the combo-box. When you select a stack frame the variables and watch windows are updated to reflect the names and values of the variables visible at that scope.</dd>
- <dt>
- <a id="setclearbkpts" name="setclearbkpts">Setting and Clearing Breakpoints</a></dt>
- <dd>
- The main desktop of the debugger contains file windows which display the contents of each script you are debugging. You may set a breakpoint in a script by doing one of the following:
- <ul>
- <li>Place the cursor on the line at which you want to set a breakpoint and right-click with the mouse. This action will display a pop-up menu. Select the <b>
- <i>
- Set Breakpoint</i>
- </b> menu item.</li>
- <li>Simply single-click on the line number of the line at which you want to set a breakpoint.</li>
- </ul>
- <p>If the selected line contains executable code a red dot will appear next to the line number and a breakpoint will be set at that location.</p>
- <p>You may clear breakpoint in a script by doing one of the following:</p>
- <ul>
- <li>Place the cursor on the line at which you want to clear a breakpoint and right-click with the mouse. This action will display a pop-up menu. Select the <b>
- <i>
- Clear Breakpoint</i>
- </b> menu item.</li>
- <li>Simply single-click on the red dot or the line number of the line at which you want to clear a breakpoint.</li>
- </ul>
- <p>The red dot will disappear and the breakpoint at that location will be cleared.</p>
- </dd>
-</dl>
-<h2 id="Viewing_Variables">Viewing Variables</h2>
-<p>The lower-left (dockable) pane in the debugger main window contains a tab-pane with two tabs, labeled "this" and "Locals". Each pane contains a tree-table which displays the properties of the current object and currently visible local variables, respectively.</p>
-<dl>
- <dt>
- <a id="this" name="this">This</a></dt>
- <dd>
- The properties of the current object are displayed in the <b>
- <i>
- this</i>
- </b> table. If a property is itself a JavaScript object the property may be expanded to show its sub-properties. The <b>
- <i>
- this</i>
- </b> table is updated each time control returns to the debugger or when you change the stack location in the <b>
- <i>
- Context:</i>
- </b> window.</dd>
- <dt>
- <a id="locals" name="locals">Locals</a></dt>
- <dd>
- The local variables of the current function are displayed in the <b>
- <i>
- Locals</i>
- </b> table. If a variable is itself a JavaScript object the variable may be expanded to show its sub-properties. The <b>
- <i>
- Locals</i>
- </b> table is updated each time control returns to the debugger or when you change the stack location in the <b>
- <i>
- Context:</i>
- </b> window</dd>
- <dt>
- Watch Window</dt>
- <dd>
- You may enter arbitrary JavaScript expressions in the <b>
- <i>
- Watch:</i>
- </b> table located in the lower-right (dockable) pane in the debugger main window. The expressions you enter are re-evaluated in the current scope and their current values displayed each time control returns to the debugger or when you change the stack location in the <b>
- <i>
- Context:</i>
- </b> window.</dd>
- <dt>
- Evaluation Window</dt>
- <dd>
- The <b>
- <i>
- Evaluate</i>
- </b> pane located in the lower-right (dockable) pane in the debugger main window contains an editable command line where you may enter arbitrary JavaScript code. The code is evaluated in the context of the current stack frame. The window maintains a history of the commands you have entered. You may move backward or forward through the history by pressing the Up/Down arrow keys on the keyboard.</dd>
-</dl>
diff --git a/files/zh-cn/mozilla/projects/rhino/documentation/index.html b/files/zh-cn/mozilla/projects/rhino/documentation/index.html
deleted file mode 100644
index 74ae49d94e..0000000000
--- a/files/zh-cn/mozilla/projects/rhino/documentation/index.html
+++ /dev/null
@@ -1,81 +0,0 @@
----
-title: Rhino 文档
-slug: Mozilla/Projects/Rhino/Documentation
-translation_of: Mozilla/Projects/Rhino/Documentation
----
-<p>以下是面向 Rhino 脚本创作者和集成者的信息.</p>
-
-<h2 id="General" name="General">概述</h2>
-
-<dl>
- <dt><a href="/zh-CN/docs/Rhino/Overview" title="Rhino_Overview">简介</a></dt>
- <dd>Rhino 和 JavaScript 的简介.</dd>
- <dt><a href="/zh-CN/docs/Rhino/License" title="Rhino_License">许可</a></dt>
- <dd>Rhino 的许可信息.</dd>
- <dt><a href="/zh-CN/docs/Rhino/Requirements_and_Limitations" title="Rhino_Requirements_and_Limitations">依赖和局限</a></dt>
- <dd>运行 Rhino 所需要的要件; 以及 Rhino 不能做什么.</dd>
- <dt><a href="/zh-CN/docs/Rhino/Downloads_archive" title="Rhino_downloads_archive">发布存档</a></dt>
- <dd>Rhino 的历史版本以及发行说明.</dd>
- <dt><a href="/zh-CN/docs/Rhino/Optimization" title="Rhino_Optimization">优化</a></dt>
- <dd>优化级别的详细说明.</dd>
- <dt><a href="/zh-CN/docs/Rhino/FAQ" title="Rhino_FAQ">FAQ</a></dt>
- <dd>针对 Rhino 的 FAQ.</dd>
- <dt><a href="/zh-CN/docs/Rhino/History">Rhino 的历史</a></dt>
- <dd>关于这只野兽(Rhino)的历史.</dd>
-</dl>
-
-<h2 id="Writing_Scripts" name="Writing_Scripts">撰写脚本</h2>
-
-<dl>
- <dt><a class="internal" href="/zh-CN/docs/Scripting_Java" title="Scripting Java">在 Java 中撰写脚本</a></dt>
- <dd>使用 Rhino 编写 Java 类的方法.</dd>
- <dt><a class="external" href="http://www.mozilla.org/rhino/scriptjava.html">在 Java 中撰写脚本</a></dt>
- <dd>使用 Rhino 编写 Java 类的方法. (旧版).</dd>
- <dt><a href="/en-US/docs/Rhino/Performance">性能</a></dt>
- <dd>撰写更高效的 JavaScript 的窍门.</dd>
-</dl>
-
-<h2 id="JavaScript_Tools" name="JavaScript_Tools">JavaScript 工具</h2>
-
-<dl>
- <dt><a href="/en-US/docs/Rhino/Shell" title="Rhino_Shell">Rhino Shell</a></dt>
- <dd>交互式或批处理式执行脚本.</dd>
- <dt><a href="/en-US/docs/Rhino/Debugger">JavaScript 调试器</a></dt>
- <dd>调试执行于 Rhino 中的脚本.</dd>
- <dt><a href="/en-US/docs/Rhino/JavaScript_Compiler" title="Rhino_JavaScript_Compiler">JavaScript 编译器</a></dt>
- <dd>将脚本编译成类文件.</dd>
- <dt><a href="/en-US/docs/Running_the_Rhino_tests" title="Running_the_Rhino_tests">运行Rhino测试</a></dt>
- <dd>使用Rhino运行javascript单元测试.</dd>
-</dl>
-
-<h2 id="Embedding_Rhino" name="Embedding_Rhino">嵌入 Rhino</h2>
-
-<dl>
- <dt><a href="/en-US/docs/Rhino/Embedding_tutorial">嵌入教程</a></dt>
- <dd>一个介绍如何将Rhino嵌入到你的应用程序的简短教程.</dd>
- <dt><a class="external" href="http://mozilla.github.io/rhino/javadoc/index.html">API Javadoc Reference</a> (无法访问?  <a href="http://www.jarvana.com/jarvana/view/org/mozilla/rhino/1.7R3/rhino-1.7R3-javadoc.jar!/index.html" title="http://www.jarvana.com/jarvana/view/org/mozilla/rhino/1.7R3/rhino-1.7R3-javadoc.jar!/index.html">Try this at Jarvana.</a>)</dt>
- <dd>一个带有解释的Rhino编程api大纲(只有一些小提示).</dd>
- <dt><a href="/en-US/docs/Rhino/Scopes_and_Contexts" title="https://developer.mozilla.org/editor/fckeditor/core/editor/en-US/docs/Rhino_documentation/Scopes_and_Contexts">Scopes and Contexts</a></dt>
- <dd>描述如何在多线程环境中高效、灵活的使用scopes和contexts.</dd>
- <dt><a href="/en-US/docs/Rhino/Serialization">序列化</a></dt>
- <dd>如何在Rhino中序列化javascript对象和函数.</dd>
- <dt><a href="/en-US/docs/Rhino/Runtime">运行时</a></dt>
- <dd>一个对于javascrit运行时的简短介绍.</dd>
- <dt><a href="/en-US/docs/Rhino/Footprint">Small Footprint</a></dt>
- <dd>对于那些热衷于小面积脚本嵌入(small-footprint embeddings)的人的提示.</dd>
- <dt><a href="/en-US/docs/Rhino/Examples">例子</a></dt>
- <dd>一些展示如何控制javascript引擎以及创建javascript<span class="web-item">宿主对象的例子.</span></dd>
- <dt><a href="/en-US/docs/Rhino/BSF">Using Rhino with Bean Scripting Framework (BSF)</a></dt>
- <dd>如何在支持BSF(Bean 脚本框架)的app中通过Apache Jakarta project使用Rhino.</dd>
-</dl>
-
-<h2 id="External_references" name="External_references">外部链接</h2>
-
-<dl>
- <dt><a class="external" href="http://www.ociweb.com/jnb/archive/jnbMar2001.html">在java中使用的脚本语言</a></dt>
- <dd>一篇将Rhino和Jython进行对比的文章.</dd>
-</dl>
-
-<h2 id="Rhino_contributors" name="Rhino_contributors">Rhino 贡献者</h2>
-
-<p>有志于为 Rhino 贡献力量? 来看看 <a href="/en-US/docs/Rhino_Wish_List" title="Rhino_Wish_List">Rhino Wish List</a> 吧.</p>
diff --git a/files/zh-cn/mozilla/projects/rhino/download_rhino/index.html b/files/zh-cn/mozilla/projects/rhino/download_rhino/index.html
deleted file mode 100644
index 54bf9966b8..0000000000
--- a/files/zh-cn/mozilla/projects/rhino/download_rhino/index.html
+++ /dev/null
@@ -1,106 +0,0 @@
----
-title: 下载 Rhino
-slug: Mozilla/Projects/Rhino/Download_Rhino
-translation_of: Mozilla/Projects/Rhino/Download_Rhino
----
-<p>Rhino 同时提供源代码和已编译形式的下载.</p>
-
-<h2 id="字节码文件">字节码文件</h2>
-
-<p>Rhino 1.7R5 是最新的稳定发行版.</p>
-
-<table class="standard-table">
- <tbody>
- <tr>
- <th scope="col">发行版本</th>
- <th scope="col">发行时间</th>
- <th scope="col">变更日志</th>
- <th scope="col">下载链接</th>
- </tr>
- <tr>
- <td>Rhino 1.7R4</td>
- <td>2012-06-18</td>
- <td><a href="/En/New_in_Rhino_1.7R4" title="En/New_in_Rhino_1.7R4">New in Rhino 1.7R4</a></td>
- <td><a class="link-https" href="https://github.com/downloads/mozilla/rhino/rhino1_7R4.zip" title="https://github.com/downloads/mozilla/rhino/rhino1_7R4.zip">rhino1_7R4.zip</a></td>
- </tr>
- <tr>
- <td>Rhino 1.7R5</td>
- <td>2015-01-29</td>
- <td><a href="https://github.com/mozilla/rhino/releases/tag/Rhino1_7R5_RELEASE">变更日志</a></td>
- <td><a href="https://github.com/mozilla/rhino/releases/download/Rhino1_7R5_RELEASE/rhino1_7R5.zip">rhino1_7R5.zip</a></td>
- </tr>
- <tr>
- <td>Rhino 1.7.6</td>
- <td>2015-04-15</td>
- <td><a href="https://github.com/mozilla/rhino/releases/tag/Rhino1_7_6_RELEASE">变更日志</a></td>
- <td><a href="https://github.com/mozilla/rhino/releases/download/Rhino1_7_6_RELEASE/rhino1.7.6.zip">rhino1.7.6.zip</a></td>
- </tr>
- <tr>
- <td>Rhino 1.7.7</td>
- <td>2015-06-17</td>
- <td><a href="https://github.com/mozilla/rhino/releases/tag/Rhino1_7_7_RELEASE">变更日志</a></td>
- <td><a href="https://github.com/mozilla/rhino/releases/download/Rhino1_7_7_RELEASE/rhino1.7.7.zip">rhino1.7.7.zip</a></td>
- </tr>
- <tr>
- <td>Rhino 1.7.7.1</td>
- <td>2016-02-01</td>
- <td><a href="https://github.com/mozilla/rhino/releases/tag/Rhino1_7_7_1_RELEASE">变更日志</a></td>
- <td><a href="https://github.com/mozilla/rhino/releases/download/Rhino1_7_7_1_RELEASE/rhino-1.7.7.1.zip">rhino1.7.7.1.zip </a></td>
- </tr>
- <tr>
- <td>Rhino 1.7.7.2</td>
- <td>2017-08-24</td>
- <td><a href="https://github.com/mozilla/rhino/releases/tag/Rhino1_7_7_2_Release">变更日志</a></td>
- <td><a href="https://github.com/mozilla/rhino/releases/download/Rhino1_7_7_2_Release/rhino-1.7.7.2.zip">rhino1.7.7.2.zip </a></td>
- </tr>
- <tr>
- <td>Rhino 1.7.8</td>
- <td>2018-01-22</td>
- <td><a href="https://github.com/mozilla/rhino/releases/tag/Rhino1_7_8_Release">变更日志</a></td>
- <td><a href="https://github.com/mozilla/rhino/releases/download/Rhino1_7_8_Release/rhino-1.7.8.zip">rhino1.7.8.zip</a></td>
- </tr>
- <tr>
- <td>Rhino 1.7.9</td>
- <td>2018-03-15</td>
- <td><a href="https://github.com/mozilla/rhino/releases/tag/Rhino1_7_9_Release">变更日志</a></td>
- <td><a href="https://github.com/mozilla/rhino/releases/download/Rhino1_7_9_Release/rhino-1.7.9.zip">rhino1.7.9.zip</a></td>
- </tr>
- <tr>
- <td>Rhino 1.7.10</td>
- <td>2018-04-09</td>
- <td><a href="https://github.com/mozilla/rhino/releases/tag/Rhino1_7_10_Release">变更日志</a></td>
- <td><a href="https://github.com/mozilla/rhino/releases/download/Rhino1_7_10_Release/rhino-1.7.10.zip">rhino1.7.10.zip</a></td>
- </tr>
- <tr>
- <td>Rhino 1.7.11</td>
- <td>2019-05-30</td>
- <td><a href="https://github.com/mozilla/rhino/releases/tag/Rhino1_7_11_Release">变更日志</a></td>
- <td><a href="https://github.com/mozilla/rhino/releases/download/Rhino1_7_11_Release/rhino-1.7.11.zip">rhino1.7.11.zip</a></td>
- </tr>
- <tr>
- <td>Rhino 1.7.12</td>
- <td>2020-01-13</td>
- <td><a href="https://github.com/mozilla/rhino/releases/tag/Rhino1_7_12_Release">变更日志</a></td>
- <td><a href="https://github.com/mozilla/rhino/releases/download/Rhino1_7_12_Release/rhino-1.7.12.zip">rhino1.7.12.zip</a></td>
- </tr>
- </tbody>
-</table>
-
-<p>下载较旧版本的Rhino,可以参考 <a class="external" href="http://developer.mozilla.org/zh-cn/docs/Rhino_downloads_archive">Rhino 下载存档.</a></p>
-
-<h2 id="许可">许可</h2>
-
-<p>Rhino 是开源的, 从 1.7R4 开始以 MPL 2.0 许可.</p>
-
-<p>在此之前的版本遵循 <a class="external" href="http://www.mozilla.org/MPL/">MPL</a> 1.1/GPL 2.0 许可.</p>
-
-<p>参考更详细的 <a href="/zh-cn/Rhino/License" title="en/Rhino license">Rhino 许可证</a> 信息.</p>
-
-<h2 id="源代码">源代码</h2>
-
-<p>除了从上面zip文件获取源外,Rhino 的源代码可以在GitHub上的<a href="https://github.com/mozilla/rhino">https://github.com/mozilla/rhino</a>找到。 要获取源,使用命令</p>
-
-<pre class="brush: bash">$ git clone https://github.com/mozilla/rhino.git
-</pre>
-
-<p>Rhino 使用 <a class="ex-ref external" href="http://ant.apache.org/">Ant</a> 作为它的构建系统.。在Rhino分配的顶级目录运行 <code>ant</code> 命令将打印打印可构建目标的清单。</p>
diff --git a/files/zh-cn/mozilla/projects/rhino/embedding_tutorial/index.html b/files/zh-cn/mozilla/projects/rhino/embedding_tutorial/index.html
deleted file mode 100644
index b7cf0168f5..0000000000
--- a/files/zh-cn/mozilla/projects/rhino/embedding_tutorial/index.html
+++ /dev/null
@@ -1,221 +0,0 @@
----
-title: 'Tutorial: Embedding Rhino'
-slug: Mozilla/Projects/Rhino/Embedding_tutorial
-translation_of: Mozilla/Projects/Rhino/Embedding_tutorial
----
-<p>Embedding Rhino can be done simply with good results. With more effort on the part of the embedder, the objects exposed to scripts can be customized further.</p>
-<p>This tutorial leads you through the steps from a simple embedding to more customized, complex embeddings. Fully compilable examples are provided along the way.</p>
-<p>The examples live in the <code>rhino/examples</code> directory in the distribution and in <code>mozilla/js/rhino/examples</code> in cvs. This document will link to them using <a href="http://lxr.mozilla.org/">lxr</a>.</p>
-<p>In this document, JavaScript code will be in <span class="java_js_code">green</span>, Java code will be in <span class="java_js_code">green,</span> and shell logs will be in <span class="shell_logs_code">purple</span>.</p>
-<h2 id="In_this_document">In this document:</h2>
-<ul class="toc">
- <li><a href="#runScript">RunScript: A simple embedding</a>
- <ul>
- <li><a href="#enteringContext">Entering a Context</a></li>
- <li><a href="#initializing">Initializing standard objects</a></li>
- <li><a href="#collecting">Collecting the arguments</a></li>
- <li><a href="#evaluating">Evaluating a script</a></li>
- <li><a href="#print">Printing the result</a></li>
- <li><a href="#exit">Exiting the Context</a></li>
- </ul>
- </li>
- <li><a href="#expose">Expose Java APIs</a>
- <ul>
- <li><a href="#useJava">Using Java APIs</a></li>
- <li><a href="#implementingInterfaces">Implementing interfaces</a></li>
- <li><a href="#addJava">Adding Java objects</a></li>
- </ul>
- </li>
- <li><a href="#usingJSObjs">Using JavaScript objects from Java</a>
- <ul>
- <li><a href="#usingJSvars">Using JavaScript variables</a></li>
- <li><a href="#callingJSfuns">Calling JavaScript functions</a></li>
- </ul>
- </li>
- <li><a href="#javaScriptHostObjects">JavaScript host objects</a>
- <ul>
- <li><a href="#definingHostObjects">Defining Host Objects</a></li>
- <li><a href="#counter">Counter example</a>
- <ul>
- <li><a href="#counterCtors">Counter's constructors</a></li>
- <li><a href="#classname">Class name</a></li>
- <li><a href="#dynamic">Dynamic properties</a></li>
- <li><a href="#definingMethods">Defining JavaScript "methods"</a></li>
- <li><a href="#addingCounter">Adding Counter to RunScript</a></li>
- </ul>
- </li>
- </ul>
- </li>
-</ul>
-<h2 id="RunScript_A_simple_embedding"><a id="runScript" name="runScript">RunScript: A simple embedding</a></h2>
-<p>About the simplest embedding of Rhino possible is the <a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/RunScript.java">RunScript example</a>. All it does it read a script from the command line, execute it, and print a result.</p>
-<p>Here's an example use of RunScript from a shell command line:</p>
-<pre class="code shell_logs_code">$ java RunScript "Math.cos(Math.PI)"
--1
-$ java RunScript "function f(x){return x+1} f(7)"
-8
-</pre>
-<p>Note that you'll have to have both the Rhino classes and the RunScript example class file in the classpath. Let's step through the body of <code>main</code> one line at time.</p>
-<h3 id="Entering_a_Context"><a id="enteringContext" name="enteringContext">Entering a Context</a></h3>
-<p>The code</p>
-<pre class="code java_js_code">Context cx = Context.enter();
-</pre>
-<p>Creates and enters a <code>Context</code>. A <code>Context</code> stores information about the execution environment of a script.</p>
-<h3 id="Initializing_standard_objects"><a name="initializing">Initializing standard objects</a></h3>
-<p>The code</p>
-<pre class="code java_js_code">Scriptable scope = cx.initStandardObjects();
-</pre>
-<p>Initializes the standard objects (<code>Object</code>, <code>Function</code>, etc.) This must be done before scripts can be executed. The <var>null</var> parameter tells <code>initStandardObjects</code> to create and return a scope object that we use in later calls.</p>
-<h3 id="Collecting_the_arguments"><a id="collecting" name="collecting">Collecting the arguments</a></h3>
-<p>This code is standard Java and not specific to Rhino. It just collects all the arguments and concatenates them together.</p>
-<pre class="code java_js_code">String s = "";
-for (int i=0; i &lt; args.length; i++) {
- s += args[i];
-}
-</pre>
-<h3 id="Evaluating_a_script"><a id="evaluating" name="evaluating">Evaluating a script</a></h3>
-<p>The code</p>
-<pre class="code java_js_code">Object result = cx.evaluateString(scope, s, "&lt;cmd&gt;", 1, null);
-</pre>
-<p>uses the Context <code>cx</code> to evaluate a string. Evaluation of the script looks up variables in <var>scope</var>, and errors will be reported with the filename <code>&lt;cmd&gt;</code> and line number 1.</p>
-<h3 id="Printing_the_result"><a id="print" name="print">Printing the result</a></h3>
-<p>The code</p>
-<pre class="code java_js_code">System.out.println(cx.toString(result));
-</pre>
-<p>prints the result of evaluating the script (contained in the variable <var>result</var>). <var>result</var> could be a string, JavaScript object, or other values. The <code>toString</code> method converts any JavaScript value to a string.</p>
-<h3 id="Exiting_the_Context"><a id="exit" name="exit">Exiting the Context</a></h3>
-<p>The code</p>
-<pre class="code java_js_code">} finally {
- Context.exit();
-}
-</pre>
-<p>exits the Context. This removes the association between the Context and the current thread and is an essential cleanup action. There should be a call to <code>exit</code> for every call to <code>enter</code>. To make sure that it is called even if an exception is thrown, it is put into the finally block corresponding to the try block starting after <code>Context.enter()</code>.</p>
-<h2 id="Expose_Java_APIs"><a id="expose" name="expose">Expose Java APIs</a></h2>
-<h3 id="Using_Java_APIs"><a id="useJava" name="useJava">Using Java APIs</a></h3>
-<p>No additional code in the embedding needed! The JavaScript feature called
- <i>
- LiveConnect</i>
- allows JavaScript programs to interact with Java objects:</p>
-<pre class="code shell_logs_code">$ java RunScript "java.lang.System.out.println(3)"
-3.0
-undefined
-</pre>
-<h3 id="Implementing_interfaces"><a id="implementingInterfaces" name="implementingInterfaces">Implementing interfaces</a></h3>
-<p>Using Rhino, JavaScript objects can implement arbitrary Java interfaces. There's no Java code to write -- it's part of Rhino's LiveConnect implementation. For example, we can see how to implement java.lang.Runnable in a Rhino shell session:</p>
-<pre class="code shell_logs_code">js&gt; obj = { run: function() { print("hi"); } }
-[object Object]
-js&gt; obj.run()
-hi
-js&gt; r = new java.lang.Runnable(obj);
-[object Object]
-js&gt; t = new java.lang.Thread(r)
-Thread[Thread-0,5,main]
-js&gt; t.start()
-hi
-</pre>
-<h3 id="Adding_Java_objects"><a id="addJava" name="addJava">Adding Java objects</a></h3>
-<p>The next example is <a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/RunScript2.java">RunScript2</a>. This is the same as RunScript, but with the addition of two extra lines of code:</p>
-<pre class="code java_js_code">Object wrappedOut = Context.javaToJS(System.out, scope);
-ScriptableObject.putProperty(scope, "out", wrappedOut);
-</pre>
-<p>These lines add a global variable <code>out</code> that is a JavaScript reflection of the <code>System.out</code> variable:</p>
-<pre class="code shell_logs_code">$ java RunScript2 "out.println(42)"
-42.0
-undefined
-</pre>
-<h2 id="Using_JavaScript_objects_from_Java"><a id="usingJSObjs" name="usingJSObjs">Using JavaScript objects from Java</a></h2>
-<p>After evaluating a script it's possible to query the scope for variables and functions, extracting values and calling JavaScript functions. This is illustrated in the <a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/RunScript3.java">RunScript3</a> example. This example adds the ability to print the value of variable <var>x</var> and the result of calling function <code>f</code>. Both <var>x</var> and <var>f</var> are expected to be defined by the evaluated script. For example,</p>
-<pre class="code shell_logs_code">$ java RunScript3 "x = 7"
-x = 7
-f is undefined or not a function.
-$ java RunScript3 "function f(a) { return a; }"
-x is not defined.
-f("my args") = my arg
-</pre>
-<h3 id="Using_JavaScript_variables"><a id="usingJSvars" name="usingJSvars">Using JavaScript variables</a></h3>
-<p>To print out the value of <var>x</var>, we add the following code:</p>
-<pre class="code java_js_code">Object x = scope.get("x", scope);
-if (x == Scriptable.NOT_FOUND) {
- System.out.println("x is not defined.");
-} else {
- System.out.println("x = " + Context.toString(x));
-}
-</pre>
-<h3 id="Calling_JavaScript_functions"><a id="callingJSfuns" name="callingJSfuns">Calling JavaScript functions</a></h3>
-<p>To get the function <var>f</var>, call it, and print the result, we add this code:</p>
-<pre class="code java_js_code">Object fObj = scope.get("f", scope);
-if (!(fObj instanceof Function)) {
- System.out.println("f is undefined or not a function.");
-} else {
- Object functionArgs[] = { "my arg" };
- Function f = (Function)fObj;
- Object result = f.call(cx, scope, scope, functionArgs);
- String report = "f('my args') = " + Context.toString(result);
- System.out.println(report);
-}
-</pre>
-<h2 id="JavaScript_host_objects"><a id="javaScriptHostObjects" name="javaScriptHostObjects">JavaScript host objects</a></h2>
-<h3 id="Defining_Host_Objects"><a id="definingHostObjects" name="definingHostObjects">Defining Host Objects</a></h3>
-<p>Custom host objects can implement special JavaScript features like dynamic properties.</p>
-<h3 id="Counter_example"><a id="counter" name="counter">Counter example</a></h3>
-<p>The <a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/Counter.java">Counter example</a> is a simple host object. We'll go through it method by method below.</p>
-<p>It's easy to try out new host object classes in the shell using its built-in <code>defineClass</code> function. We'll see how to add it to RunScript later. (Note that because the <code>java -jar</code> option preempts the rest of the classpath, we can't use that and access the <code>Counter</code> class.)</p>
-<pre class="code shell_logs_code">$ java -cp "js.jar;examples" org.mozilla.javascript.tools.shell.Main
-js&gt; defineClass("Counter")
-js&gt; c = new Counter(7)
-[object Counter]
-js&gt; c.count
-7
-js&gt; c.count
-8
-js&gt; c.count
-9
-js&gt; c.resetCount()
-js&gt; c.count
-0
-</pre>
-<h3 id="Counter's_constructors"><a id="counterCtors" name="counterCtors">Counter's constructors</a></h3>
-<p>The zero-argument constructor is used by Rhino runtime to create instances. For the counter example, no initialization work is needed, so the implementation is empty.</p>
-<pre class="code java_js_code">public Counter () { }
-</pre>
-<p>The method <code>jsConstructor</code> defines the JavaScript constructor that was called with the expression <code>new Counter(7)</code> in the JavaScript code above.</p>
-<pre class="code java_js_code">public void jsConstructor(int a) { count
-= a; }
-</pre>
-<h3 id="Class_name"><a id="classname" name="classname">Class name</a></h3>
-<p>The class name is defined by the <code>getClassName</code> method. This is used to determine the name of the constructor.</p>
-<pre class="code java_js_code">public String getClassName() { return "Counter";
-}
-</pre>
-<h3 id="Dynamic_properties"><a id="dynamic" name="dynamic">Dynamic properties</a></h3>
-<p>Dynamic properties are defined by methods beginning with <code>jsGet_</code> or <code>jsSet_</code>. The method <code>jsGet_count</code> defines the
- <i>
- count</i>
- property.</p>
-<pre class="code java_js_code">public int jsGet_count() { return count++;
-}
-</pre>
-<p>The expression <code>c.count</code> in the JavaScript code above results in a call to this method.</p>
-<h3 id="Defining_JavaScript_methods"><a id="definingMethods" name="definingMethods">Defining JavaScript "methods"</a></h3>
-<p>Methods can be defined using the <code>jsFunction_ prefix</code>. Here we define <code>resetCount</code> for JavaScript.</p>
-<pre class="code java_js_code">public void jsFunction_resetCount() { count
-= 0; }
-</pre>
-<p>The call <code>c.resetCount()</code> above calls this method.</p>
-<h3 id="Adding_Counter_to_RunScript"><a id="addingCounter" name="addingCounter">Adding Counter to RunScript</a></h3>
-<p>Now take a look at the <a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/RunScript4.java">RunScript4 example</a>. It's the same as RunScript except for two additions. The method <code>ScriptableObject.defineClass</code> uses a Java class to define the Counter "class" in the top-level scope:</p>
-<pre class="code java_js_code">ScriptableObject.defineClass(scope, Counter.class);
-</pre>
-<p>Now we can reference the <code>Counter</code> object from our script:</p>
-<pre class="code shell_logs_code">$ java RunScript4 "c = new Counter(3); c.count;
-c.count;"
-</pre>
-<p>It also creates a new instance of the <code>Counter</code> object from within our Java code, constructing it with the value 7, and assigning it to the top-level variable <code>myCounter</code>:</p>
-<pre class="code java_js_code">Object[] arg = { new Integer(7) };
-Scriptable myCounter = cx.newObject(scope, "Counter", arg);
-scope.put("myCounter", scope, myCounter);
-</pre>
-<p>Now we can reference the <code>myCounter</code> object from our script:</p>
-<pre class="code shell_logs_code">$ java RunScript3 'RunScript4 'myCounter.count; myCounter.count'
-8
-</pre>
diff --git a/files/zh-cn/mozilla/projects/rhino/examples/index.html b/files/zh-cn/mozilla/projects/rhino/examples/index.html
deleted file mode 100644
index 087697b94a..0000000000
--- a/files/zh-cn/mozilla/projects/rhino/examples/index.html
+++ /dev/null
@@ -1,35 +0,0 @@
----
-title: Rhino Examples
-slug: Mozilla/Projects/Rhino/Examples
-translation_of: Mozilla/Projects/Rhino/Examples
----
-<div>
-  </div>
-<p></p>
-<p>Examples have been provided that show how to control the JavaScript engine and how  to implement scriptable host objects. All the examples are in the git tree at <code><a href="https://github.com/mozilla/rhino/tree/master/examples/">mozilla/js/rhino/examples</a></code>.</p>
-<h2 id="Sample_Scripts"><a id="sample" name="sample">Sample Scripts</a></h2>
-<p>The <code><a href="https://github.com/mozilla/rhino/tree/master/examples/unique.js">unique.js</a></code> script allows printing unique lines from a file.</p>
-<p>The <code><a href="https://github.com/mozilla/rhino/tree/master/examples/liveConnect.js">liveConnect.js</a></code> script shows a sample usage of LiveConnect (Java-to-JavaScript connectivity).</p>
-<p>The <code><a href="https://github.com/mozilla/rhino/tree/master/examples/jsdoc.js">jsdoc.js</a></code> script is a JavaScript analog to Java's <code>javadoc</code>. It makes heavy use of regular expressions.</p>
-<p>The <code><a href="https://github.com/mozilla/rhino/tree/master/examples/checkParam.js">checkParam.js</a></code> script is a useful tool to check that <code>@param</code> tags in Java documentation comments match the parameters in the corresponding Java method.</p>
-<p>The <code><a href="https://github.com/mozilla/rhino/tree/master/examples/enum.js">enum.js</a></code> script is a good example of using a JavaAdapter to implement a Java interface using a JavaScript object.</p>
-<p>The <a href="https://github.com/mozilla/rhino/tree/master/examples/NervousText.js">NervousText.js</a> script is a JavaScript implementation of the famous NervousText applet using JavaScript compiled to Java classes using <a href="jsc.html">jsc</a>. It can be run in the HTML page <a href="https://github.com/mozilla/rhino/tree/master/examples/NervousText.html">NervousText.html</a>.</p>
-<h2 id="Controlling_the_JavaScript_Engine"><a id="controlling" name="controlling">Controlling the JavaScript Engine</a></h2>
-<h4 id="The_RunScript_class">The RunScript class</h4>
-<p><code><a href="https://github.com/mozilla/rhino/tree/master/examples/RunScript.java">RunScript.java</a></code> is a simple program that executes a script from the command line.</p>
-<h4 id="The_Control_class">The Control class</h4>
-<p><code><a href="https://github.com/mozilla/rhino/tree/master/examples/Control.java">Control.java</a></code> is a program that executes a simple script and then manipulates the result.</p>
-<h4 id="JavaScript_Shell">JavaScript Shell</h4>
-<p><code><a href="https://github.com/mozilla/rhino/tree/master/examples/Shell.java">Shell.java</a></code> is a program that executes JavaScript programs; it is a simplified version of the shell in the <code>tools</code> package. The programs may be specified as files on the command line or by typing interactively while the shell is running.</p>
-<h4 id="PrimitiveWrapFactory">PrimitiveWrapFactory</h4>
-<p><a href="https://github.com/mozilla/rhino/tree/master/examples/PrimitiveWrapFactory.java">PrimitiveWrapFactory.java</a> is an example of a WrapFactory that can be used to control the wrapping behavior of the Rhino engine on calls to Java methods.</p>
-<h4 id="Multithreaded_Script_Execution">Multithreaded Script Execution</h4>
-<p><code><a href="https://github.com/mozilla/rhino/tree/master/examples/DynamicScopes.java">DynamicScopes.java</a></code> is a program that creates a single global scope object and then shares it across multiple threads. Sharing the global scope allows both information to be shared across threads, and amortizes the cost of Context.initStandardObjects by only performing that expensive operation once.</p>
-<h2 id="Implementing_Host_Objects">Implementing Host Objects</h2>
-<p>First check out the <a href="/en/docs/Rhino/Embedding_tutorial">tutorial</a> if you haven't already.</p>
-<h4 id="The_Foo_class_-_Extending_ScriptableObject">The Foo class - Extending ScriptableObject</h4>
-<p><code><a href="https://github.com/mozilla/rhino/tree/master/examples/Foo.java">Foo.java</a></code> is a simple JavaScript host object that includes a property with an associated action and a variable argument method.</p>
-<h4 id="The_Matrix_class_-_Implementing_Scriptable">The Matrix class - Implementing Scriptable</h4>
-<p><code><a href="https://github.com/mozilla/rhino/tree/master/examples/Matrix.java">Matrix.java</a></code> provides a simple multidimensional array by implementing the Scriptable interface.</p>
-<h4 id="The_File_class_-_An_advanced_example">The File class - An advanced example</h4>
-<p><code><a href="https://github.com/mozilla/rhino/tree/master/examples/File.java">File.java</a></code> extends ScriptableObject to provide a means of reading and writing files from JavaScript. A more involved example of host object definition.</p>
diff --git a/files/zh-cn/mozilla/projects/rhino/index.html b/files/zh-cn/mozilla/projects/rhino/index.html
deleted file mode 100644
index 86818aa172..0000000000
--- a/files/zh-cn/mozilla/projects/rhino/index.html
+++ /dev/null
@@ -1,22 +0,0 @@
----
-title: Rhino
-slug: Mozilla/Projects/Rhino
-translation_of: Mozilla/Projects/Rhino
----
-<p><img alt="Image:rhino.jpg" class="internal" src="/@api/deki/files/832/=Rhino.jpg"></p>
-
-<p><strong>Rhino </strong>是一个完全使用Java语言编写的开源<a href="/zh-CN/docs/Web/JavaScript">JavaScript</a>实现。Rhino通常用于在Java程序中,为最终用户提供脚本化能力。它被作为J2SE 6上的默认Java脚本化引擎。</p>
-
-<h4 id="Rhino_downloads" name="Rhino_downloads">Rhino 下载</h4>
-
-<p>如何 <a class="internal" href="/zh-cn/Rhino/Download_Rhino" title="zh-cn/Rhino/Download Rhino">获取源码和二进制文件</a><a id="fck_paste_padding"></a><a id="fck_paste_padding"></a>. </p>
-
-<h4 id="Rhino_documentation" name="Rhino_documentation">Rhino 文档</h4>
-
-<p>为脚本编写者和嵌入者提供的 <a href="/zh-CN/docs/Mozilla/Projects/Rhino/Documentation">一些Rhino信息</a>.</p>
-
-<h4 id="Rhino_help" name="Rhino_help">Rhino 帮助</h4>
-
-<p>如果你被卡住了,可以参考 <a href="/zh-CN/docs/Mozilla/Projects/Rhino/Community">这里的一些资源</a>.</p>
-
-<p>{{ languages( { "zh-cn": "zh-cn/Rhino" } ) }}</p>
diff --git a/files/zh-cn/mozilla/projects/rhino/license/index.html b/files/zh-cn/mozilla/projects/rhino/license/index.html
deleted file mode 100644
index 035688ed65..0000000000
--- a/files/zh-cn/mozilla/projects/rhino/license/index.html
+++ /dev/null
@@ -1,47 +0,0 @@
----
-title: Rhino license
-slug: Mozilla/Projects/Rhino/License
-translation_of: Mozilla/Projects/Rhino/License
----
-<p>Rhino is available under open source licenses.</p>
-
-<h2 id="MPL.2FGPL_License" name="MPL.2FGPL_License">MPL/GPL License</h2>
-
-<p>The majority of the source code for Rhino is available under a <a class="external" href="http://www.mozilla.org/MPL/">MPL 1.1/GPL 2.0</a> license.</p>
-
-<h2 id="License_for_portions_of_the_Rhino_debugger" name="License_for_portions_of_the_Rhino_debugger">License for portions of the Rhino debugger</h2>
-
-<p>Additionally, some files (currently the contents of toolsrc/org/mozilla/javascript/tools/debugger/treetable/) are available under the following license:</p>
-
-<pre> * Copyright 1997, 1998 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * - Neither the name of Sun Microsystems nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-</pre>
-
-<hr>
-<p><a href="/User:Norrisboyd" title="User:Norrisboyd">Norrisboyd</a> 06:16, 14 April 2008 (PDT)</p>
diff --git a/files/zh-cn/mozilla/projects/rhino/overview/index.html b/files/zh-cn/mozilla/projects/rhino/overview/index.html
deleted file mode 100644
index ba6a9aaa18..0000000000
--- a/files/zh-cn/mozilla/projects/rhino/overview/index.html
+++ /dev/null
@@ -1,78 +0,0 @@
----
-title: Rhino overview
-slug: Mozilla/Projects/Rhino/Overview
-translation_of: Mozilla/Projects/Rhino/Overview
----
-<h3 id="Introduction" name="Introduction">简介</h3>
-
-<p>大多数用过 <a href="/en/JavaScript" title="en/JavaScript">JavaScript</a> 的人都是将js脚本放入<a href="/en/HTML" title="en/HTML">HTML</a>页面中使用。然而, Rhino 仅仅是对javascript核心部分的实现,并没有包含操作HTML的对象或方法。</p>
-
-<p>Rhino 包括</p>
-
-<ul>
- <li> <a href="/en/New_in_JavaScript_1.7" title="en/New_in_JavaScript_1.7">JavaScript 1.7</a>的全部特性</li>
- <li>可以用脚本方式调用Java</li>
- <li>用一个<a href="/en/Rhino/Shell" title="en/Rhino/Shell">JavaScript Shell</a>来执行JavaScript脚本</li>
- <li>用一个<a href="/en/Rhino/JavaScript_Compiler" title="en/Rhino/JavaScript_Compiler">JavaScript编译器</a> 来将JavaScript脚本文件转换成Java类文件</li>
- <li>用一个<a class="external" href="http://www.mozilla.org/rhino/debugger.html">JavaScript调试器</a> 来调试Rhino执行的脚本</li>
-</ul>
-
-<h3 id="Language" name="Language">语言</h3>
-
-<p>JavaScript 的标准是 <a class="external" href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">Standard ECMA-262 ECMAScript: A general purpose, cross-platform programming language</a>. Rhino 1.3 及以上版本遵照上述标准的第3版。</p>
-
-<p>Rhino 1.6 及以上版本实现了 <a class="external" href="http://www.ecma-international.org/publications/standards/Ecma-357.htm">ECMA-357 ECMAScript for XML (E4X)</a> 标准. 查看详细的规格说明可以获得更多的信息,查看 <a class="external" href="http://www.mozilla.org/rhino/rhino16R1.html#E4X">Rhino version 1.6R1 release notes</a> 可以看到Rhino对标准实现的具体情况。</p>
-
-<p>此外,Rhino实现了JavaAdapters,这样我们可以用一个JavaScript对象来实现任何java的接口或者继承任何java的类。查看下载文件中example文件夹中的<code class="filename">enum.js获取更多的信息。</code>.</p>
-
-<p>有很多JavaScript的书和教程。 我们推荐<a class="external" href="http://www.oreilly.com/catalog/jscript5/">JavaScript: The Definitive Guide</a> 这本书,里面有一章是说Rhino的。</p>
-
-<h3 id="Deprecated_Language_Features" name="Deprecated_Language_Features">废弃的语言特性</h3>
-
-<p>很多在JavaScript 1.2中定义的特性已经被废弃了. 这些特性允许“计算反射”:可以决定和影响它被评价方法等方面的能力。 这些特性没有被广泛使用,他们对阻碍和防止优化的行为强加了重要的约束。 这些被废弃的特性是 <code>__proto__</code> 和 <code>__parent__</code> 属性, 还有构造函数 <code>With</code>,、<code>Closure<font face="Open Sans, sans-serif"><span style="line-height: 21px;">和</span></font></code><code>Call。</code>在JavaScript 1.4中使用这些特性会产生错误。在其他的版本中使用这些特性,会产生警告。</p>
-
-<h3 id="Internationalization" name="Internationalization">国际化</h3>
-
-<p>The messages reported by the JavaScript engine are by default retrieved from the property file <code class="filename">org/mozilla/javascript/resources/Messages.properties</code>. If other properties files with extensions corresponding to the current locale exist, they will be used instead.</p>
-
-<h3 id="JavaScript_Language_Versions" name="JavaScript_Language_Versions">JavaScript语言版本</h3>
-
-<p>JavaScript引擎的很多行为与语言的版本有关。在浏览器调用中,JavaScript版本的选择是通过script标签中的LANGUAGE属性定义的,比如"JavaScript1.2"。</p>
-
-<p>1.3 和更高版本是ECMA一致的。</p>
-
-<h4 id="Operators_.3D.3D_and_.21.3D" name="Operators_.3D.3D_and_.21.3D">操作符 <code>==</code>  和 <code>!=</code></h4>
-
-<p>1.2版本用 <code>==</code> 和 <code>!=</code> 来处理绝对相等的问题。 在1.3或更高的版本里, <code>==</code> 和 <code>!=</code> 和ECMA中所描述的一样。 操作符 <code>===</code> and <code>!==</code> 在所有版本中都表示绝对相等。</p>
-
-<h4 id="ToBoolean" name="ToBoolean">布尔转换</h4>
-
-<p><code>1.3之前的所有版本Boolean(new Boolean(false))</code> 值为<code>false</code> 。在1.3及1.3之后,它的值为<font face="Courier New, Andale Mono, monospace"><span style="line-height: normal;">true。</span></font></p>
-
-<h4 id="Array.prototype.toString_and_Object.prototype.toString" name="Array.prototype.toString_and_Object.prototype.toString"><code>Array.prototype.toString 和 Object.prototype.toString</code></h4>
-
-<p>1.2版本只是返回数组或对象的文字符号 (比如<code>"{{ mediawiki.external(1,2,3) }}"</code> or <code>"{a:1, b:2}"</code> )。 在1.3或更高版本中这些函数与ECMA标准一致。</p>
-
-<h4 id="Array_constructor" name="Array_constructor"><code>Array</code> 构造函数</h4>
-
-<p><code>只有在1.2版本中,Array(<var>i</var>)</code> 用一个参数i构造一个只有一个元素且元素的值为i的数组。 在其他版本中,使用和ECMA一致的标准 (一个没有元素的数组被构造,长度为i)。</p>
-
-<h4 id="String.prototype.substring" name="String.prototype.substring"><code>String.prototype.substring</code></h4>
-
-<p>只有在1.2版本中, 如果第一个参数小于第二个参数,两个参数不会互换。其他的版本都符合ECMA标准。</p>
-
-<h4 id="String.prototype.split" name="String.prototype.split"><code>String.prototype.split</code></h4>
-
-<p>只有对1.2版本,split按照Perl4的特例当用一个单独的空格字符作参数时, (跳过最先的空白,用空白分割). 其他的版本完全按照ECMA的标准分割。</p>
-
-<h3 id="Security" name="Security">安全</h3>
-
-<p>Rhino的安全特性提供了找到代码片段的来源的功能 (还有任何会轮流产生的代码片段)。这些特性考虑到了传统的基于URL的安全策略(在网景领航员中的JavaScript)的实现。执行信任的JavaScript代码时可以不考虑安全性特征。</p>
-
-<p>运行不被信任的JavaScript代码时,需要做两件事来保证安全性。第一,每一个被创建的Context必须被提供一个实现SecuritySupport接口的实例。 这样在功能上给Rhino提供了让它执行安全相关任务的支持。</p>
-
-<p>第二, <code>security.requireSecurityDomain属性的值应该被改为</code><code>true在资源束</code>bundle <code>org.mozilla.javascript.resources.Security中</code>. 这个属性的值可以在运行时通过调用<code style="font-size: 14px;">Context<font face="Open Sans, sans-serif"><span style="line-height: 21px;">的</span></font></code><code style="font-size: 14px;">isSecurityDomainRequired方法来决定。将这个属性设置为ture,要求任何编译或评估JavaScript的调用必须提供一个安全区域对象(任意类型),用来标识JavaScript代码。在一个典型的客户端嵌入中,这个对象可能是提供javascript的服务器的URL,或者是一个包含代码片段的签发人的代表(用于基于证书的安全策略)。</code></p>
-
-<p>当JavaScript代码想要执行一个受限制的行为时,安全区域会被后面的方法检索。类上下文会从安全管理(<code>java.lang.SecurityManager.getClassContext())中得到。执行限制行为的代码对应的类</code> 可以通过寻找一个在类上下文中合适的位置得到。如果调用者是JavaScript,得到的类可能是一种或两种类型。首先,它可能是解释器(如果解释器模式有效)。第二,它有可能是一个生成的类,如果类文件生成支持。一个植入可以区分两种情况,通过调用在Context Class中调用<code>isInterpreterClass()。</code> 如果是解释器类,调用Context的<code>getInterpreterSecurityDomain()</code> 方法来获取当前正在执行的被解释的脚本或方法的安全区域。否则,就是一个生成的类,一个嵌入可以调用在实现<span style="font-family: courier new,andale mono,monospace; line-height: normal;">SecuritySupport的类中调用</span><code style="font-size: 14px;">getSecurityDomain()。当类被定义而且被打开,恰当的安全区域和它建立关联,而且可以通过调用这个方法找回。一旦安全区域被决定,一个植入可以执行任何检查者适合去决定是否允许去做的操作。</code></p>
-
-<p>{{ languages( { "ja": "ja/Rhino_Overview" } ) }}</p>
diff --git a/files/zh-cn/mozilla/projects/rhino/requirements_and_limitations/index.html b/files/zh-cn/mozilla/projects/rhino/requirements_and_limitations/index.html
deleted file mode 100644
index 8a159ae843..0000000000
--- a/files/zh-cn/mozilla/projects/rhino/requirements_and_limitations/index.html
+++ /dev/null
@@ -1,24 +0,0 @@
----
-title: Rhino requirements and limitations
-slug: Mozilla/Projects/Rhino/Requirements_and_Limitations
-translation_of: Mozilla/Projects/Rhino/Requirements_and_Limitations
----
-<h2 id="Requirements" name="Requirements">Requirements</h2>
-<p>Recent versions of Rhino have only been tested with JDK 1.4 and greater. Older versions support JDKs as early as 1.1.</p>
-<p>To use the JavaAdapter feature or an optimization level of 0 or greater, Rhino must be running under a security manager that allows the definition of class loaders.</p>
-<h2 id="Limitations" name="Limitations">Limitations</h2>
-<h3 id="LiveConnect" name="LiveConnect">LiveConnect</h3>
-<p>If a JavaObject's field's name collides with that of a method, the value of that field is retrieved lazily, and can be counter-intuitively affected by later assignments:</p>
-<pre>javaObj.fieldAndMethod = 5;
-var field = javaObj.fieldAndMethod;
-javaObj.fieldAndMethod = 7;
-// now, field == 7
-</pre>
-<p>You can work around this by forcing the field value to be converted to a JavaScript type when you take its value:</p>
-<pre>javaObj.fieldAndMethod = 5;
-var field = javaObj.fieldAndMethod + 0; // force conversion now
-javaObj.fieldAndMethod = 7;
-// now, field == 5
-</pre>
-<h3 id="JSObject" name="JSObject">JSObject</h3>
-<p>Rhino does <strong>NOT</strong> support the <code class="filename">netscape.javascript.JSObject</code> class.</p>
diff --git a/files/zh-cn/mozilla/projects/rhino/scripting_java/index.html b/files/zh-cn/mozilla/projects/rhino/scripting_java/index.html
deleted file mode 100644
index 013ad3aa89..0000000000
--- a/files/zh-cn/mozilla/projects/rhino/scripting_java/index.html
+++ /dev/null
@@ -1,397 +0,0 @@
----
-title: Scripting Java
-slug: Mozilla/Projects/Rhino/Scripting_Java
-translation_of: Mozilla/Projects/Rhino/Scripting_Java
----
-<p>这篇文章描述了如何在rhino中使用java。使用脚本调用Java有很多用途,它使得我们可以利用Java中现有的库,来帮助我们构建强大的脚本。我们可以通过编写脚本,来对Java程序进行测试。可以通过脚本来进行探索式编程,辅助Java的开发,所谓探索式编程,就是通过快速地编程调用库或API来探索这些库或API可以做什么,显而易见,脚本语言很适合探索式编程。</p>
-
-<p>这里注意,ECMA标准并没有包含和Java(或者其他任何对象系统)交互的标准。本文所描述的所有内容,应该被认为是一个扩展。</p>
-
-
-
-<h3 id="访问_Java_Packages_和_Classes">访问 Java Packages 和 Classes</h3>
-
-<p>Java的每段代码都是类的一部分,每一个JAVA类都是包的一部分。在Javascript中,脚本不属于任何package。我们可以访问Java包中的类么?</p>
-
-<p>Rhino定义了一个顶层的变量Packages。Packages的所有属性都是Java中顶层的包,比如java和com。比如我们可以访问java包:</p>
-
-<pre class="code">js&gt; Packages.java
-[JavaPackage java]</pre>
-
-<p>还有一种更方便的方式,Rhino定义了一个顶层的变量java,等价于Packages.java。所以上面的例子可以更简介地写成:</p>
-
-<pre class="code">js&gt; java
-[JavaPackage java]
-</pre>
-
-<p>我们可以通过访问包的下层,来直接访问java类:</p>
-
-<pre class="code">js&gt; java.io.File
-[JavaClass java.io.File]
-</pre>
-
-<p>如果你的脚本需要访问很多的Java类,每次都附带完整的包名会使得编程很麻烦。Rhino提供了一个顶层的方法importPackage,它的功能和Java的import一样。比如,我们可以导入java.io包中的所有类,然后直接通过类名File来访问java.io.File:</p>
-
-<pre class="code">js&gt; importPackage(java.io)
-js&gt; File
-[JavaClass java.io.File]
-</pre>
-
-<p>这里importPackage(java.io)使得java.io包中的所有类(例如File)可以在顶层被访问。这和Java中的java.io.*;等价。</p>
-
-<p>要注意Java会暗中导入java.lang.*,但是Rhino不会。因为JavaScript的顶层对象Boolean、Math、Number、Object和String和java.lang包中同名的类并不相同。因为这种冲突,建议不要用importPackage来导入java.lang包。</p>
-
-<p>有一点要注意的,就是Rhino对于指定包名或类名时是如何处理错误的。如果java.Myclass是可访问的,Rhino会试图加载名为java.MyClass的类,如果加载失败,它会假设java.MyClass是一个包名,不会报错:</p>
-
-<pre class="code">js&gt; java.MyClass
-[JavaPackage java.MyClass]
-</pre>
-
-<p>只有在你试图将这个对象当作类使用时,才会报错。</p>
-
-<h4 id="额外的包和类">额外的包和类</h4>
-
-<p>额外的包和类也可以在Rhino中使用。确认你的.jar或.class文件在你的classpath里,你就可以在你的JavaScript应用中导入它们。这些包基本不会在java包中,所以你在使用时,需要在包前加上前缀"Packages"。 比如你想导入 <code>org.mozilla.javascript</code> 包,你应该像下面这样去使用importPackage():</p>
-
-<pre class="code">$ java org.mozilla.javascript.tools.shell.Main
-js&gt; importPackage(Packages.org.mozilla.javascript);
-js&gt; Context.currentContext;
-org.mozilla.javascript.Context@bb6ab6
-</pre>
-
-<p>偶尔,我们也会见到在一些例子中使用包的完整名称,而没有使用importPackage()。这也是可以的,只是会让你多打一些字。如果使用完整的名称,上面的例子就会变成下面这样:</p>
-
-<pre class="code">$ java org.mozilla.javascript.tools.shell.Main
-js&gt; jsPackage = Packages.org.mozilla.javascript;
-[JavaPackage org.mozilla.javascript]
-js&gt; jsPackage.Context.currentContext;
-org.mozilla.javascript.Context@bb6ab6
-</pre>
-
-<p>同样,你可以通过importClass()来导入一个类,上面的例子也可以像这样写:</p>
-
-<pre>$ java org.mozilla.javascript.tools.shell.Main
-js&gt; importClass(Packages.org.mozilla.javascript.Context);
-js&gt; Context.currentContext;
-org.mozilla.javascript.Context@bb6ab6</pre>
-
-<h3 id="和Java一起工作">和Java一起工作</h3>
-
-<p>现在我们可以访问Java类,下一步就是要创建一个对象。方法就和在Java中一样, 用new来创建对象:</p>
-
-<pre class="code">js&gt; new java.util.Date()
-Thu Jan 24 16:18:17 EST 2002
-</pre>
-
-<p>如果我们将创建的对象存放在JavaScript变量中,我们可以调用它的方法:</p>
-
-<pre class="code">js&gt; f = new java.io.File("test.txt")
-test.txt
-js&gt; f.exists()
-true
-js&gt; f.getName()
-test.txt
-</pre>
-
-<p>静态方法和属性可以直接通过类对象来访问:</p>
-
-<pre class="code">js&gt; java.lang.Math.PI
-3.141592653589793
-js&gt; java.lang.Math.cos(0)
-1
-</pre>
-
-<p>不像Java,在JavaScript里,方法就是一个对象。它可以被评估,也可以被调用。如果我们去查看这个方法,我们可以看到这个方法所有重载的形式:</p>
-
-<pre class="code">js&gt; f.listFiles
-function listFiles() {/*
-java.io.File[] listFiles()
-java.io.File[] listFiles(java.io.FilenameFilter)
-java.io.File[] listFiles(java.io.FileFilter)
-*/}
-</pre>
-
-<p>输出告诉我们,File类有listFiles方法的三种重载:一种不包含参数的,另一种包含一个FilenameFilter类型的参数,第三个包含一个FileFilter类型的参数。所有的方法都返回一个File对象数组。可以观察到Java方法的参数和返回类型在探索式编程中是非常有用的,尤其是在对一个方法的参数和返回对象不确定的时候。</p>
-
-<p>另一个有助于探索式编程的特性,是可以看到对象中定义的所有方法和属性。用JavaScript的<code>for..in</code> , 我们可以打印这些值:</p>
-
-<pre class="code">js&gt; for (i in f) { print(i) }
-exists
-parentFile
-mkdir
-toString
-wait
-<em>[44 others]</em>
-</pre>
-
-<p>注意这里不仅列出了File类中的所有方法,也列出了从基类java.lang.Object中继承的方法,例如wait。这使得我们可以更好地处理那些有复杂继承关系的对象,因为我们可以看到对象中所有可用的方法。</p>
-
-<p>Rhino可以通过属性名来方便地访问JavaBean的属性。一个JavaBean的属性foo被方法getFoo和setFoo定义,另外,一个也叫foo的boolean类型的属性,可以被isFoo来定义。比如, 下面的代码实际上调用了File对象的getName和isDirectory方法。</p>
-
-<pre class="code">js&gt; f.name
-test.txt
-js&gt; f.directory
-false
-</pre>
-
-<h3 id="调用重载方法"><font><font>调用重载方法</font></font></h3>
-
-<p> <span id="noHighlight_0.8335956993210636">根据参数类型选择调用方法的过程称为重载决议。在 Java 中, 重载决议在编译时执行, 而在rhino中则在运行时发生。这种差异是不可避免的, 因为 JavaScript 使用动态类型, 在2章中: 由于变量的类型直到运行时才知道, 才会发生重载决议。</span></p>
-
-<div class="textArea" id="destText" style="direction: ltr;">
-<div><span id="noHighlight_0.37802431709856343">例如, 请查看下面的 Java 类, 它定义了许多重载方法并调用它们。</span> </div>
-</div>
-
-
-
-<pre class="code">public class Overload {
-
- public String f(Object o) { return "f(Object)"; }
- public String f(String s) { return "f(String)"; }
- public String f(int i) { return "f(int)"; }
-
- public String g(String s, int i) { return "g(String,int)"; }
- public String g(int i, String s) { return "g(int,String)"; }
-
- public static void main(String[] args) {
- Overload o = new Overload();
- Object[] a = new Object[] { new Integer(3), "hi", Overload.class };
- for (int i = 0; i != a.length; ++i)
- System.out.println(o.f(a[i]));
- }
-}
-</pre>
-
-<p><span id="noHighlight_0.42609135329922554">当我们编译和执行程序, 它产生输出</span></p>
-
-<pre class="code">f(Object)
-f(Object)
-f(Object)
-</pre>
-
-<p><span id="noHighlight_0.9335258512242988">但是, 如果我们编写一个类似的脚本</span></p>
-
-<pre class="code">var o = new Packages.Overload();
-var a = [ 3, "hi", Packages.Overload ];
-for (var i = 0; i != a.length; ++i)
- print(o.f(a[i]));
-</pre>
-
-<p>并且运行它,将会输出</p>
-
-<pre class="code">f(int)
-f(String)
-f(Object)
-</pre>
-
-<p>因为Rhino在运行时选择重载方法, <span id="noHighlight_0.45030814581159195">所以它会调用与该参数匹配的更具体的类型。</span> <span id="noHighlight_0.45030814581159195">同时, 在编译时, Java 只在参数的类型上选择重载方法。</span></p>
-
-<p>尽管这有利于选择一种方法,这种方法可能是每个调用的更好匹配,但它确实对性能有影响,因为每次调用时都要做更多的工作。事实上,这种性能代价在实际应用中并不明显。</p>
-
-<p>因为重载决议发生在运行时,它可能在运行时失败。例如,如果我们用两个整数调用重载方法g,我们就会得到一个错误,因为方法的两个形式都比另一个更接近参数类型:</p>
-
-<pre class="code">js&gt; o.g(3,4)
-js:"&lt;stdin&gt;", line 2: The choice of Java method Overload.g
-matching JavaScript argument types (number,number) is ambiguous;
-candidate methods are:
-class java.lang.String g(java.lang.String,int)
-class java.lang.String g(int,java.lang.String)
-</pre>
-
-<p><a href="http://www.mozilla.org/js/liveconnect/lc3_method_overloading.html">http://www.mozilla.org/js/liveconnect/lc3_method_overloading.html</a> 提供了<font><font>一个更精确的重载语义定义</font><font>。</font></font></p>
-
-<h3 id="实现Java接口">  实现Java接口</h3>
-
-
-
-<p>现在我们可以访问Java类,创建Java对象,并访问这些对象的字段、方法和属性,我们就可以轻松掌握大量的功能。但是,在少数情况下是不够用的:Java中的很多API通过提供客户端必须实现的接口来工作。其中一个例子就是<font face="consolas, Liberation Mono, courier, monospace"><span style="background-color: rgba(220, 220, 220, 0.498039);">Thread</span></font>类:其构造函数Runnable包含一个<font face="consolas, Liberation Mono, courier, monospace"><span style="background-color: rgba(220, 220, 220, 0.498039);">run</span></font>方法,这个方法在新线程启动时被调用。</p>
-
-<p>为了满足这种需求,Rhino提供了创建新的Java对象实现的接口的能力。首先,我们必须定义一个JavaScript对象,其中的函数属性的名称与Java接口所需的方法名称相匹配。要实现一个<code>Runnable</code> ,我们只需要定义一个不带参数的<font face="consolas, Liberation Mono, courier, monospace"><span style="background-color: rgba(220, 220, 220, 0.498039);">run</span></font>单方法。如果你还记得第3章,可以用{ propertyName: value}符号定义一个JavaScript对象。我们可以在这里结合函数表达式使用这个语法来用一个 <font face="consolas, Liberation Mono, courier, monospace"><span style="background-color: rgba(220, 220, 220, 0.498039);">run</span></font>方法定义一个JavaScript对象:</p>
-
-<pre class="code">js&gt; obj = { run: function () { print("\nrunning"); } }
-[object Object]
-js&gt; obj.run()
-
-running
-</pre>
-
-
-
-<p>现在我们可以通过构建一个 <code>Runnable</code> 来实现 <code>Runnable</code> 接口的对象:</p>
-
-<pre><code>js&gt; r = new java.lang.Runnable(obj);</code></pre>
-
-
-
-<pre class="code">js&gt; r = new java.lang.Runnable(obj);
-[object JavaObject]
-</pre>
-
-<p><font><font>在Java中,不可能</font></font><font><font>在接口上</font><font>使用</font></font><code>new</code><font><font>运算符,因为没有可用的实现。</font><font>Rhino从JavaScript对象中获取实现</font></font><code>obj</code><font><font>。</font><font>现在我们有一个对象实现</font></font><code>Runnable</code><font><font>,我们可以创建</font></font><code>Thread</code><font><font>并运行它。</font><font>我们定义的函数</font></font><code>run </code><font><font>将在新线程上调用。</font></font></p>
-
-<pre class="code">js&gt; t = new java.lang.Thread(r)
-Thread[Thread-2,5,main]
-js&gt; t.start()
-js&gt;
-
-running
-</pre>
-
-
-
-<p><font><font>最终</font></font><code>js</code><font><font>提示和新线程的输出可能以任意顺序显示,具体取决于线程调度。</font></font></p>
-
-<p>在后台,Rhino为一个新的Java类生成字节码,该类实现 <code>Runnable</code> 并转发对其 <font face="consolas, Liberation Mono, courier, monospace"><span style="background-color: rgba(220, 220, 220, 0.498039);">run</span></font>方法的所有调用,并转发给关联的JavaScript对象。实现此类的对象称为Java适配器。因为转发到JavaScript是在运行时发生的,所以可能会延迟定义实现接口的方法直到它们被调用。虽然省略必要的方法对大编程来说是一种糟糕的做法,但它对小脚本和探索性编程很有用。</p>
-
-
-
-<h3 id="JavaAdapter构造函数"><font><font>JavaAdapter构造函数</font></font></h3>
-
-<p>在前面的章节中,我们使用 <code>new</code> 运算符与Java接口创建Java适配器。这种方法有其局限性:不可能实现多个接口,也不能扩展非抽象类。因为这些<font><font>原因,有一个</font></font> <code>JavaAdapter</code> 构造函数。</p>
-
-<p><code>JavaAdapter</code><font><font>构造函数</font><font>的语法</font><font>是:</font></font></p>
-
-<pre class="code">new JavaAdapter(javaIntfOrClass, [javaIntf, ..., javaIntf,] javascriptObject)
-</pre>
-
-<p><code><font face="Open Sans, arial, x-locale-body, sans-serif"><span style="background-color: #ffffff;">这里</span></font>javaIntfOrClass</code>是一个实现的接口或一个扩展的类,并且<code>javaIntf</code>是实现接口的接口。而<code>javascriptObject</code> 则包含从Java适配器调用的方法的JavaScript对象。</p>
-
-<p>在实践中,几乎不需要<code>JavaAdapter</code> 直接调用构造函数。大多数情况下,使用<code>new</code>运算符之前的语法就足够了。</p>
-
-<h3 id="作为Java接口的JavaScript函数"><font><font>作为Java接口的JavaScript函数</font></font></h3>
-
-<p>通常我们只需要使用一种方法实现一个接口,<font><font>就像前面的</font></font> <code>Runnable</code> <font><font>例子或者提供各种事件监听器实现一样。</font>为了方便这个,Rhino允许在这种接口传递JavaScript函数。</font><font>该函数被称为接口方法的实现。</font></p>
-
-<p>这里是简化的 <code>Runnable</code> 实例:</p>
-
-<pre class="code">js&gt; t = java.lang.Thread(function () { print("\nrunning"); });
-Thread[Thread-0,5,main]
-js&gt; t.start()
-js&gt;
-running
-</pre>
-
-<p><font>如果所有的方法都具有相同的签名,Rhino还允许使用JavaScript函数作为Java接口的实现方法。当调用函数时,Rhino将方法的名称作为附加参数传递。函数可以使用它</font>来代表被调用<font>的方法:</font></p>
-
-<pre class="code">js&gt; var frame = new Packages.javax.swing.JFrame();
-js&gt; frame.addWindowListener(function(event, methodName) {
- if (methodName == "windowClosing") {
- print("Calling System.exit()..."); java.lang.System.exit(0);
- }
- });
-js&gt; frame.setSize(100, 100);
-js&gt; frame.visible = true;
-true
-js&gt; Calling System.exit()...
-</pre>
-
-<h3 id="创建Java数组"><font><font>创建Java数组</font></font></h3>
-
-<p>Rhino不提供创建Java数组的特殊语法。你必须使用这个 <code>java.lang.reflect.Array</code> 类来达到这个目的。要创建一个由五个Java字符串组成的数组,可以进行以下调用:</p>
-
-<pre class="code">js&gt; a = java.lang.reflect.Array.newInstance(java.lang.String, 5);
-[Ljava.lang.String;@7ffe01
-</pre>
-
-<p>要创建一个基本类型数组,我们必须使用 <code>java.lang</code> 包中相关对象类中定义的特殊TYPE字段。例如,要创建一个字节数组,我们必须使用特殊字段 <code>java.lang.Byte.TYPE</code>:</p>
-
-<pre class="code">js&gt; a = java.lang.reflect.Array.newInstance(java.lang.Character.TYPE, 2);
-[C@7a84e4
-</pre>
-
-<p>而且结果值是允许被使用在该类型的Java数组的任何地方。</p>
-
-<pre class="code">js&gt; a[0] = 104
-104
-js&gt; a[1] = 105
-105
-js&gt; new java.lang.String(a)
-hi
-</pre>
-
-<h3 id="Java字符串和JavaScript字符串"><font><font>Java字符串和JavaScript字符串</font></font></h3>
-
-<p><font><font>请记住,Java字符串和JavaScript字符串是</font></font><strong><font><font>不</font></font></strong><font><font>一样的。</font><font>Java字符串类型的实例,</font></font><code>java.lang.String</code> ,<font><font>并具有由该类定义的所有方法。</font><font>JavaScript字符串具有由...定义的方法,</font></font><code>String.prototype</code>. <font><font>最常见的绊脚石是</font></font> <code>length</code>, <font><font><font face="consolas, Liberation Mono, courier, monospace">这是Java</font>字符串方法和JavaScript字符串的动态属性:</font></font></p>
-
-<pre class="code">js&gt; javaString = new java.lang.String("Java")
-Java
-js&gt; jsString = "JavaScript"
-JavaScript
-js&gt; javaString.length()
-4
-js&gt; jsString.length
-10
-</pre>
-
-<p>Rhino <font>在减少这两种类型之间的差异方面提供了一些帮助。</font><font>首先,您可以将JavaScript字符串传递给需要Java字符串的Java方法,Rhino将执行转换。</font><font>实际上,我们在前面</font><code>java.lang.String</code> <font>例子中</font><font>的</font><font>构造函数</font><font>调用中看到了这个特性</font><font>。</font></p>
-
-<p><font>如果</font><code>java.lang.String</code> <font>类尚未定义它们,Rhino还会使JavaScript方法可用于Java字符串。例如:</font></p>
-
-<pre class="code">js&gt; javaString.match(/a.*/)
-ava
-</pre>
-
-<h3 id="JavaImporter_构造函数">JavaImporter 构造函数</h3>
-
-<p><code>JavaImporter</code>是一个新的全局构造函数,它允许在脚本化Java时省略显式的包名称:</p>
-
-<pre>var SwingGui = JavaImporter(Packages.javax.swing,
- Packages.javax.swing.event,
- Packages.javax.swing.border,
- java.awt.event,
- java.awt.Point,
- java.awt.Rectangle,
- java.awt.Dimension);
-...
-
-with (SwingGui) {
- var mybutton = new JButton(test);
- var mypoint = new Point(10, 10);
- var myframe = new JFrame();
-...
-}
-</pre>
-
-<p>以前,这样的功能仅适用于将 <code>org.mozilla.javascript.ImporterTopLevel</code> 用作顶级作用域的嵌入。这个类提供额外的 <code>importPackage()</code> 和<code>importClass()</code> 全局函数的脚本,但其广泛的使用有污染Java类名的全局命名空间的趋势,还有防止垃圾收集加载类。</p>
-
-<p>详情请参阅 <a href="http://bugzilla.mozilla.org/show_bug.cgi?id=245882">Bugzilla 245882</a>.</p>
-
-<h3 id="Java_异常">Java 异常</h3>
-
-
-
-<p><font><font>JavaScript代码使用</font></font> <code>try ... catch</code> 语句<font><font>可以捕获Java方法抛出的异常</font><font>。</font><font>Rhino将Java异常封装到具有以下属性的错误对象中:</font></font></p>
-
-<ul>
- <li><code>javaException</code><font><font>:Java方法抛出的原始异常</font></font></li>
- <li><code>rhinoException</code><font><font>:由Rhino运行时包装的异常</font></font></li>
-</ul>
-
-<p><code>instanceof</code><font><font>运算符可用于查询异常的类型:</font></font></p>
-
-
-
-<pre>try {
- java.lang.Class.forName("NonExistingClass");
-} catch (e) {
- if (e.javaException instanceof java.lang.ClassNotFoundException) {
- print("Class not found");
- }
-}
-</pre>
-
-<p>Rhino 还支持对 <code>try... catch</code> 语句的扩展,允许定义条件捕获异常:</p>
-
-<pre>function classForName(name) {
- try {
- return java.lang.Class.forName(name);
- } catch (e if e.javaException instanceof java.lang.ClassNotFoundException) {
- print("Class " + name + " not found");
- } catch (e if e.javaException instanceof java.lang.NullPointerException) {
- print("Class name is null");
- }
-}
-
-classForName("NonExistingClass");
-classForName(null);
-</pre>
diff --git a/files/zh-cn/mozilla/projects/rhino/shell/index.html b/files/zh-cn/mozilla/projects/rhino/shell/index.html
deleted file mode 100644
index d5a4b779a9..0000000000
--- a/files/zh-cn/mozilla/projects/rhino/shell/index.html
+++ /dev/null
@@ -1,179 +0,0 @@
----
-title: Shell
-slug: Mozilla/Projects/Rhino/Shell
-translation_of: Mozilla/Projects/Rhino/Shell
----
-<p>JavaScript的外壳提供了一个简单的方法来在批处理模式下或编程的一个探索性的互动环境运行脚本.</p>
-<h3 id="Invoking_the_Shell" name="Invoking_the_Shell">调用Shell</h3>
-<p>&lt;big&gt;<code>java org.mozilla.javascript.tools.shell.Main {{ mediawiki.external('<var>options</var>') }} <var>script-filename-or-url</var> {{ mediawiki.external('<var>script-arguments</var>') }} </code>&lt;/big&gt;</p>
-<p>这里是一些选项 <code><var>options</var></code></p>
-<h4 id="-e_script-source" name="-e_script-source"><code>-e <var>script-source</var></code></h4>
-<p>把 <var>script-source</var>  作为 JavaScript 执行.</p>
-<h4 id="-f_script-filename-or-url" name="-f_script-filename-or-url"><code>-f <var>script-filename-or-url</var></code></h4>
-<p>读取<var>script-filename-or-url</var> 的内容并作为JavaScript执行.</p>
-<h4 id="-opt_optLevel_.2F_-O_optLevel" name="-opt_optLevel_.2F_-O_optLevel"><code>-opt <var>optLevel</var></code> / <code>-O <var>optLevel</var></code></h4>
-<p>优化等级 <var>optLevel</var>, 必须是 <code>-1</code> 或 [0-9]之间的整数. 参考<a href="/en/Rhino/Optimization" title="en/Rhino_Optimization">Rhino Optimization</a> 或许详情.</p>
-<h4 id="-version_versionNumber" name="-version_versionNumber"><code>-version <var>versionNumber</var></code></h4>
-<p>制定语言编译版本. 字符串 <var>versionNumber</var> 必须是 <code>100</code>, <code>110</code>, <code>120</code>, <code>130</code>, <code>140</code>, <a class="external" href="/en/JavaScript/New_in_JavaScript/1.5" title="https://developer.mozilla.org/editor/fckeditor/core/editor/en/New_in_JavaScript_1.5"><code>150</code></a>, <code><a class="external" href="/en/JavaScript/New_in_JavaScript/1.6" title="https://developer.mozilla.org/editor/fckeditor/core/editor/en/New_in_JavaScript_1.6">160</a> 或 <a class="external" href="/en/JavaScript/New_in_JavaScript/1.7" title="https://developer.mozilla.org/editor/fckeditor/core/editor/en/New_in_JavaScript_1.7">170</a></code>. 参考<a href="/en/Rhino/Overview#JavaScript_Language_Versions" title="en/Rhino_Overview#JavaScript_Language_Versions">JavaScript Language Versions</a>获取更多的语言版本信息.</p>
-<h4 id="-strict" name="-strict"><code>-strict</code></h4>
-<p>开启strict 模式.</p>
-<h4 id="-continuations" name="-continuations"><code>-continuations</code></h4>
-<p>启用continuation的实验支持,建立优化级别为-1强制解释模式. 从Rhino 1.7 开始这个选项不再可用.</p>
-<h4 id="Note" name="Note">注意</h4>
-<p>如果shell被使用设置为<code>true</code>的系统属性<code>rhino.use_java_policy_security调用,一个安全管理将被安装</code>, shell限制脚本通过基于根据URL访问Java安全选项的权限.如果JVM实现Java2的安全模型才可以用.</p>
-<h3 id="Predefined_Properties" name="Predefined_Properties">预定义的属性</h3>
-<p>在shell中呗执行的脚本访问顶层定义的一些属性.</p>
-<h4 id="arguments" name="arguments"><code>arguments</code></h4>
-<p><code>当shell被调用时,arguments</code> 对象是一个包含所有通过命令行输入的字符串的数组</p>
-<h4 id="environment" name="environment"><code>environment</code></h4>
-<p>返回当前环境对象.</p>
-<h4 id="history" name="history"><code>history</code></h4>
-<p>显示命令行中执行命令的历史.</p>
-<h4 id="help.28.29" name="help.28.29"><code>help()</code></h4>
-<p>获取帮助信息.</p>
-<h4 id="defineClass.28className.29" name="defineClass.28className.29"><code>defineClass(<var>className</var>)</code></h4>
-<p>定义一个使用Java类命名的扩展,参数 <var>className</var>是个类名的字符串. 使用 <code>ScriptableObject.defineClass()</code> 定义扩展.</p>
-<h4 id="deserialize.28filename.29" name="deserialize.28filename.29"><code>deserialize(<var>filename</var>)</code></h4>
-<p>从指定的文件恢复以前通过调用一个被<code>serialize</code>的对象.</p>
-<h4 id="gc" name="gc"><code>gc()</code></h4>
-<p>运行垃圾回收器.</p>
-<h4 id="load.28.5Bfilename.2C_....5D.29" name="load.28.5Bfilename.2C_....5D.29"><code>load([<var>filename</var>, ...])</code></h4>
-<p>载入字符串命名的参数JavaScript源码文件. 如果有多个参数被传递,那么每一个参数都会被读取并执行.</p>
-<h4 id="loadClass.28className.29" name="loadClass.28className.29"><code>loadClass(<var>className</var>)</code></h4>
-<p>载入并执行字符串<var>className</var>.表示的类.这个类必须是已实现的脚本接口, 就像任何被编译的脚本 <a href="/en/Rhino/JavaScript_Compiler" title="en/Rhino_JavaScript_Compiler">Rhino JavaScript Compiler</a>.</p>
-<h4 id="print.28.5Bexpr_....5D.29" name="print.28.5Bexpr_....5D.29"><code>print([<var>expr</var> ...])</code></h4>
-<p>评估并打印表达式. 评估每一个表达式, 把结果转化为字符串并打印.</p>
-<h4 id="readFile.28path_.5B.2C_characterCoding.29" name="readFile.28path_.5B.2C_characterCoding.29"><code>readFile(<var>path</var> [, <var>characterCoding]</var>)</code></h4>
-<p>读取给定的文件并使用指定的编码把字节转换为字符串,如果没有制定编码就用默认编码.</p>
-<h4 id="readUrl.28url_.5B.2C_characterCoding.29" name="readUrl.28url_.5B.2C_characterCoding.29"><code>readUrl(<var>url</var> [, <var>characterCoding</var>])</code></h4>
-<p>打开指定的url,读取所有的字节并用指定的编码转化为数组,如果没有指定编码就是用默认的.</p>
-<h4 id="runCommand.28commandName.2C_.5Barg.2C_....5D_.5Boptions.5D.29" name="runCommand.28commandName.2C_.5Barg.2C_....5D_.5Boptions.5D.29"><code>runCommand(<var>commandName</var>, [<var>arg</var>, ...] [<var>options</var>])</code></h4>
-<p>执行参数中给定的命令,作为一个独立的进程选项并返回该进程的退出状态.</p>
-<p>Usage:</p>
-<pre>runCommand(command)
-runCommand(command, arg1, ..., argN)
-runCommand(command, arg1, ..., argN, options)
-</pre>
-<p>All except the last arguments to <code>runCommand</code> are converted to strings and denote command name and its arguments. If the last argument is a JavaScript object, it is an option object. Otherwise it is converted to string denoting the last argument and options objects assumed to be empty.</p>
-<p>The following properties of the option object are processed:</p>
-<ul>
- <li><code>args</code> - provides an array of additional command arguments</li>
- <li><code>env</code> - explicit environment object. All its enumeratable properties define the corresponding environment variable names.</li>
- <li><code>input</code> - the process input. If it is not <code>java.io.InputStream</code>, it is converted to string and sent to the process as its input. If not specified, no input is provided to the process.</li>
- <li><code>output</code> - the process output instead of <code>java.lang.System.out</code>. If it is not instance of <code>java.io.OutputStream</code>, the process output is read, converted to a string, appended to the output property value converted to string and put as the new value of the output property.</li>
- <li><code>err</code> - the process error output instead of <code>java.lang.System.err</code>. If it is not instance of <code>java.io.OutputStream</code>, the process error output is read, converted to a string, appended to the err property value converted to string and put as the new value of the err property.</li>
-</ul>
-<h4 id="seal.28object.29" name="seal.28object.29"><code>seal(<var>object</var>)</code></h4>
-<p>Seal the specified object so any attempt to add, delete or modify its properties would throw an exception.</p>
-<h4 id="serialize.28object.2C_filename.29" name="serialize.28object.2C_filename.29"><code>serialize(<var>object</var>, <var>filename</var>)</code></h4>
-<p>Serialize the given object to the specified file.</p>
-<h4 id="spawn.28functionOrScript.29" name="spawn.28functionOrScript.29"><code>spawn(<var>functionOrScript</var>)</code></h4>
-<p>Run the given function or script in a different thread.</p>
-<h4 id="sync.28function.29" name="sync.28function.29"><code>sync(<var>function</var>)</code></h4>
-<p>creates a synchronized function (in the sense of a Java <code>synchronized</code> method) from an existing function. The new function synchronizes on the <code>this</code> object of its invocation.</p>
-<h4 id="quit.28.29" name="quit.28.29"><code>quit()</code></h4>
-<p>退出shell. 如果文件字符是在提示符下键入,shell将也退出在交互模式下.</p>
-<h4 id="version.28.5Bnumber.5D.29" name="version.28.5Bnumber.5D.29"><code>version([<var>number</var>])</code></h4>
-<p>设置或获取JavaScript的版本号. 如果没有参数,就返回当前的版本. 如果有参数,参数要在 <code>100</code>, <code>110</code>, <code>120</code>, <code>130</code>, <code>140</code>, <code>150</code>, <code>160 或 170范围内,它们分别对应</code> JavaScript1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6 or 1.7.</p>
-<h3 id="Examples" name="Examples">例子</h3>
-<h4 id="Invocation" name="Invocation">调用</h4>
-<p>Here the shell is invoked three times from the command line. (The system command prompt is shown as <code>$</code>.) The first invocation executes a script specified on the command line itself. The next invocation has no arguments, so the shell goes into interactive mode, reading and evaluating each line as it is typed in. Finally, the last invocation executes a script from a file and accesses arguments to the script itself.</p>
-<pre>$ java org.mozilla.javascript.tools.shell.Main -e print('hi')
-hi
-$ java org.mozilla.javascript.tools.shell.Main
-js&gt; print('hi')
-hi
-js&gt; 6*7
-42
-js&gt; function f() {
- return a;
-}
-js&gt; var a = 34;
-js&gt; f()
-34
-js&gt; quit()
-$ cat echo.js
-for (i in arguments) {
- print(arguments[i])
-}
-$ java org.mozilla.javascript.tools.shell.Main echo.js foo bar
-foo
-bar
-$
-</pre>
-<h4 id="spawn_and_sync" name="spawn_and_sync"><code>spawn</code> 和 sync </h4>
-<p>下面的例子创建了2个线程 via <code>spawn</code> 和 uses <code>sync</code> 去创建同步的函数test <code>test版本.</code></p>
-<pre>js&gt; function test(x) {
- print("entry");
- java.lang.Thread.sleep(x*1000);
- print("exit");
-}
-js&gt; var o = { f : sync(test) };
-js&gt; spawn(function() {o.f(5);});
-Thread[Thread-0,5,main]
-entry
-js&gt; spawn(function() {o.f(5);});
-Thread[Thread-1,5,main]
-js&gt;
-exit
-entry
-exit
-</pre>
-<h4 id="runCommand" name="runCommand"><code>运行命令</code></h4>
-<p>这是在Linux下调用 <code>runCommand</code> 的例子.</p>
-<pre>js&gt; runCommand('date')
-Thu Jan 23 16:49:36 CET 2003
-0
-// Using input option to provide process input
-js&gt; runCommand("sort", {input: "c\na\nb"})
-a
-b
-c
-0
-js&gt; // Demo of output and err options
-js&gt; var opt={input: "c\na\nb", output: 'Sort Output:\n'}
-js&gt; runCommand("sort", opt)
-0
-js&gt; print(opt.output)
-Sort Output:
-a
-b
-c
-js&gt; var opt={input: "c\na\nb", output: 'Sort Output:\n', err: ''}
-js&gt; runCommand("sort", "--bad-arg", opt)
-2
-js&gt; print(opt.err)
-/bin/sort: unrecognized option `--bad-arg'
-Try `/bin/sort --help' for more information.
-
-js&gt; runCommand("bad_command", "--bad-arg", opt)
-js: "&lt;stdin&gt;", line 18: uncaught JavaScript exception: java.io.IOException: bad_command: not found
-js&gt; // Passing explicit environment to the system shell
-js&gt; runCommand("sh", "-c", "echo $env1 $env2", { env: {env1: 100, env2: 200}})
-100 200
-0
-js&gt; // Use args option to provide additional command arguments
-js&gt; var arg_array = [1, 2, 3, 4];
-js&gt; runCommand("echo", { args: arg_array})
-1 2 3 4
-0
-</pre>
-<p>Windows下的例子也差不多:</p>
-<pre>js&gt; // Invoke shell command
-js&gt; runCommand("cmd", "/C", "date /T")
-27.08.2005
-0
-js&gt; // Run sort collectiong the output
-js&gt; var opt={input: "c\na\nb", output: 'Sort Output:\n'}
-js&gt; runCommand("sort", opt)
-0
-js&gt; print(opt.output)
-Sort Output:
-a
-b
-c
-js&gt; // Invoke notepad and wait until it exits
-js&gt; runCommand("notepad")
-0
-</pre>
-<p>{{ languages( { "zh-cn": "zh-cn/Shell" } ) }}</p>