没有合适的资源?快使用搜索试试~ 我知道了~
JDK12-nashorn-users-guide.pdf
需积分: 5 0 下载量 147 浏览量
2023-08-08
07:34:22
上传
评论
收藏 267KB PDF 举报
温馨提示
试读
35页
JDK12-nashorn-users-guide
资源推荐
资源详情
资源评论
Java Platform, Standard Edition
Nashorn User's Guide
Release 12
F13632-01
March 2019
Java Platform, Standard Edition Nashorn User's Guide, Release 12
F13632-01
Copyright © 2015, 2019, Oracle and/or its affiliates. All rights reserved.
This software and related documentation are provided under a license agreement containing restrictions on
use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your
license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify,
license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means.
Reverse engineering, disassembly, or decompilation of this software, unless required by law for
interoperability, is prohibited.
The information contained herein is subject to change without notice and is not warranted to be error-free. If
you find any errors, please report them to us in writing.
If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on
behalf of the U.S. Government, then the following notice is applicable:
U.S. GOVERNMENT END USERS: Oracle programs, including any operating system, integrated software,
any programs installed on the hardware, and/or documentation, delivered to U.S. Government end users are
"commercial computer software" pursuant to the applicable Federal Acquisition Regulation and agency-
specific supplemental regulations. As such, use, duplication, disclosure, modification, and adaptation of the
programs, including any operating system, integrated software, any programs installed on the hardware,
and/or documentation, shall be subject to license terms and license restrictions applicable to the programs.
No other rights are granted to the U.S. Government.
This software or hardware is developed for general use in a variety of information management applications.
It is not developed or intended for use in any inherently dangerous applications, including applications that
may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you
shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its
safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this
software or hardware in dangerous applications.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of
their respective owners.
Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are
used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron,
the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro
Devices. UNIX is a registered trademark of The Open Group.
This software or hardware and documentation may provide access to or information about content, products,
and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly
disclaim all warranties of any kind with respect to third-party content, products, and services unless otherwise
set forth in an applicable agreement between you and Oracle. Oracle Corporation and its affiliates will not be
responsible for any loss, costs, or damages incurred due to your access to or use of third-party content,
products, or services, except as set forth in an applicable agreement between you and Oracle.
Contents
Preface
Audience v
Documentation Accessibility v
Related Documents v
Conventions v
1
Introduction to the Nashorn Engine
Invoking Nashorn from Java Code 1-1
Invoking Nashorn from the Command Line 1-2
Nashorn Parser API 1-3
2
The Nashorn Java API
Accessing Java Classes 2-1
Creating Java Objects 2-3
Accessing Class and Instance Members 2-3
Using JavaBeans 2-4
Working with Java Arrays 2-5
Working with Java Strings 2-6
Working with Java Numbers 2-6
Working with Java Lists and Maps 2-6
Extending Java Classes 2-7
Restricting Script Access to Specified Java Classes 2-8
Using Class Filters 2-9
Restricting Access to Java Reflection APIs 2-9
Example of Using the ClassFilter Interface 2-9
3
Nashorn and JavaFX
Interpreting JavaFX Script Application with Nashorn 3-1
Using Nashorn to Simplify JavaFX Script Applications 3-2
Example of a JavaFX Application (HelloWorld.java) 3-2
iii
Example of a JavaFX Script Application (HelloWorld.js) 3-3
Example of a Simpler Version of JavaFX Script Application
(HelloWorldSimple.js) 3-3
Nashorn Script Objects 3-3
Example of a JavaFX Script Application with Loaded Scripts 3-4
4
Nashorn and Shell Scripting
Shebang 4-1
String Interpolation 4-2
Here Document 4-3
Global Objects 4-3
Additional Nashorn Built-in Functions 4-5
A
JavaFX Script Application Examples
Example JavaFX 3-D A-1
Example JavaFX Animation A-2
iv
Preface
This document describes the use of the Nashorn engine for Java application
development with scripting features provided by the Java Platform, Standard Edition
(Java SE).
Audience
This document is intended for Java programmers who want to use the Nashorn engine
for scripting features provided by Java SE. It is assumed that you are familiar with
Java and a version of the ECMAScript language standard (JavaScript).
Documentation Accessibility
For information about Oracle's commitment to accessibility, visit the Oracle
Accessibility Program website at http://www.oracle.com/pls/topic/lookup?
ctx=acc&id=docacc.
Access to Oracle Support
Oracle customers that have purchased support have access to electronic support
through My Oracle Support. For information, visit http://www.oracle.com/pls/topic/
lookup?ctx=acc&id=info or visit http://www.oracle.com/pls/topic/lookup?ctx=acc&id=trs
if you are hearing impaired.
Related Documents
• Scripting Languages and Java
in Java Platform, Standard Edition Java Scripting Programmer's Guide
• The Java Scripting API specification (the javax.script package)
• The
jjs
and
jrunscript
tools enable you to invoke the Nashorn engine from the
command line.
Conventions
The following text conventions are used in this document:
Convention
Meaning
boldface Boldface type indicates graphical user interface elements associated
with an action, or terms defined in text or the glossary.
v
剩余34页未读,继续阅读
资源评论
weixin_40191861_zj
- 粉丝: 63
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功