Rhino

来自开放百科 - 灰狐
(版本间的差异)
跳转到: 导航, 搜索
 
 
(未显示1个用户的13个中间版本)
第1行: 第1行:
Rhino: JavaScript for Java
+
{{SeeWikipedia|Rhino (JavaScript engine)}}
  
http://www.mozilla.org/rhino/
+
请关注新一代产品:[[Nashorn]]
 +
 
 +
Rhino is an open-source implementation of [[JavaScript]] written entirely in Java. It is typically embedded into Java applications to provide scripting to end users. It is embedded in J2SE 6 as the default Java scripting engine.
 +
 
 +
The majority of the source code for Rhino is available under a MPL 1.1/GPL 2.0 license.
 +
 
 +
[[Rhino on Rails]]
 +
 
 +
Rhino contains
 +
* All the features of JavaScript 1.7
 +
* Allows direct scripting of Java
 +
* A JavaScript shell for executing JavaScript scripts
 +
* A JavaScript compiler to transform JavaScript source files into Java class files
 +
* A JavaScript debugger for scripts executed with Rhino
 +
==Shell==
 +
$ java -jar js.jar
 +
Rhino 1.7 release 1 2008 03 06
 +
js> var now = new java.util.Date()
 +
js> var slidesDue = java.util.Calendar.getInstance()
 +
js> slidesDue.set(2008,3,14) // March 14? Why so early?
 +
js> slidesDue.getTime()
 +
Mon Apr 14 18:53:54 EDT 2008
 +
js> slidesDue.set(2008,2,14) // What were they thinking with the date stuff, anyway?
 +
js> slidesDue.set(2008,2,14,23,59) // let's be done by
 +
11:59 PM; I do have a day job
 +
js> ((slidesDue.getTime().getTime() - now.getTime()) / 1000 / 60 / 60).toFixed(1) + " hours to go" // mix Java and JS APIs
 +
29.1 hours to go
 +
js> print("Huihoo Power!") // shell defines print()
 +
Huihoo Power!
 +
==Links==
 +
*http://www.mozilla.org/rhino/
 +
*http://docs.huihoo.com/javascript/
 +
*http://download.huihoo.com/mozilla/rhino/
 +
*http://docs.huihoo.com/mozilla/rhino/
 +
 
 +
[[category:JavaScript]]
 +
[[category:JavaScript engine]]
 +
[[category:mozilla]]
 +
[[category:java]]

2016年6月23日 (四) 07:17的最后版本

Wikipedia-35x35.png 您可以在Wikipedia上了解到此条目的英文信息 Rhino Thanks, Wikipedia.

请关注新一代产品:Nashorn

Rhino is an open-source implementation of JavaScript written entirely in Java. It is typically embedded into Java applications to provide scripting to end users. It is embedded in J2SE 6 as the default Java scripting engine.

The majority of the source code for Rhino is available under a MPL 1.1/GPL 2.0 license.

Rhino on Rails

Rhino contains

  • All the features of JavaScript 1.7
  • Allows direct scripting of Java
  • A JavaScript shell for executing JavaScript scripts
  • A JavaScript compiler to transform JavaScript source files into Java class files
  • A JavaScript debugger for scripts executed with Rhino

[编辑] Shell

$ java -jar js.jar
Rhino 1.7 release 1 2008 03 06
js> var now = new java.util.Date()
js> var slidesDue = java.util.Calendar.getInstance()
js> slidesDue.set(2008,3,14) // March 14? Why so early?
js> slidesDue.getTime()
Mon Apr 14 18:53:54 EDT 2008
js> slidesDue.set(2008,2,14) // What were they thinking with the date stuff, anyway?
js> slidesDue.set(2008,2,14,23,59) // let's be done by 
11:59 PM; I do have a day job
js> ((slidesDue.getTime().getTime() - now.getTime()) / 1000 / 60 / 60).toFixed(1) + " hours to go" // mix Java and JS APIs
29.1 hours to go
js> print("Huihoo Power!") // shell defines print()
Huihoo Power!

[编辑] Links

分享您的观点
个人工具
名字空间

变换
操作
导航
工具箱