87 lines
3.4 KiB
HTML
87 lines
3.4 KiB
HTML
<!-- ***** BEGIN LICENSE BLOCK *****
|
|
- Version: MPL 1.1/GPL 2.0
|
|
-
|
|
- The contents of this file are subject to the Mozilla Public License Version
|
|
- 1.1 (the "License"); you may not use this file except in compliance with
|
|
- the License. You may obtain a copy of the License at
|
|
- http://www.mozilla.org/MPL/
|
|
-
|
|
- Software distributed under the License is distributed on an "AS IS" basis,
|
|
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
- for the specific language governing rights and limitations under the
|
|
- License.
|
|
-
|
|
- The Original Code is Rhino code, released May 6, 1999.
|
|
-
|
|
- The Initial Developer of the Original Code is
|
|
- Netscape Communications Corporation.
|
|
- Portions created by the Initial Developer are Copyright (C) 1997-1999
|
|
- the Initial Developer. All Rights Reserved.
|
|
-
|
|
- Contributor(s):
|
|
-
|
|
- Alternatively, the contents of this file may be used under the terms of
|
|
- the GNU General Public License Version 2 or later (the "GPL"), in which
|
|
- case the provisions of the GPL are applicable instead of those above. If
|
|
- you wish to allow use of your version of this file only under the terms of
|
|
- the GPL and not to allow others to use your version of this file under the
|
|
- MPL, indicate your decision by deleting the provisions above and replacing
|
|
- them with the notice and other provisions required by the GPL. If you do
|
|
- not delete the provisions above, a recipient may use your version of this
|
|
- file under either the MPL or the GPL.
|
|
-
|
|
- ***** END LICENSE BLOCK ***** -->
|
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<meta http-equiv="Content-Language" content="en">
|
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
|
<meta http-equiv="Content-Script-Type" content="text/javascript">
|
|
<meta name="Author" content="Norris Boyd">
|
|
<meta name="KeyWords" content="Rhino, JavaScript, Java">
|
|
<title>Rhino FAQ</title>
|
|
|
|
<link rel="up" href="./" title="Rhino project page">
|
|
|
|
</head>
|
|
<body>
|
|
<script type="text/javascript" src="owner.js"></script>
|
|
|
|
<p class="crumbs"><em>You are here:</em> <a href="./">Rhino project page</a> >
|
|
<strong>Rhino FAQ</strong></p>
|
|
|
|
<h1 style="text-align: center;">Frequently Asked Questions about Rhino</h1>
|
|
<script type="text/javascript">document.write(owner());</script>
|
|
|
|
<dl>
|
|
|
|
<dt>How do I create a Java array from JavaScript?</dt>
|
|
<dd>You must use Java reflection. For instance, to create an array
|
|
of java.lang.String of length five, do
|
|
<pre class="code">
|
|
var stringArray = java.lang.reflect.Array.newInstance(java.lang.String, 5);
|
|
</pre>
|
|
<p>Then if you wish to assign the string "hi" to the first element, simply
|
|
execute <var>stringArray[0] = "hi"</var>.</p>
|
|
<p>Creating arrays of primitive types is slightly different: you must use
|
|
the TYPE field. For example, creating an array of seven ints can be done
|
|
with the code</p>
|
|
<pre class="code">
|
|
var intArray = java.lang.reflect.Array.newInstance(java.lang.Integer.TYPE, 7);
|
|
</pre><br><br></dd>
|
|
|
|
<dt>When I try to execute a script I get the exception <code>Required security context missing</code>. What's going on?</dt>
|
|
<dd>You've likely missed placing the
|
|
<code class="filename">Security.properties</code> file in your class path at
|
|
<code class="filename">org.mozilla.javascript.resources</code>.</dd>
|
|
|
|
</dl>
|
|
|
|
</body>
|
|
</html>
|