Oracle Proposes New Native JavaScript Engine for OpenJDK 80
hypnosec writes "Oracle has proposed a new project for OpenJDK — Nashorn, which aims to implement a high-performance yet lightweight JavaScript runtime that would run on the JVM natively. Nashorn will be headed by Jim Laskey, multi-language Lead at Oracle and the project will be sponsored by HotSpot group. The project proposes an implementation of JavaScript such that it can run standalone JavaScript applications via the JSR 223 APIs. Nashorn's design will enable it to take advantage of new JVM technologies like the MethodHandles and the InvokeDynamic APIs."
Don't let them patent it! (Score:1)
There has been standalone javascript apps (node.js is just one of them).; given history of Oracle they are going to take this idea present it as their own and then sue everyone and their grandmother.
Re:Don't let them patent it! (Score:5, Informative)
There have also been standalone javascript engines running on the JVM; the best-developed is Rhino [mozilla.org] from Mozilla.
Re: (Score:2, Funny)
Nashorn is German for Rhinocerus .. So we wonder is this just another Rhino fork??
Re: (Score:2)
Nope, written from scratch.
Re:Don't let them patent it! (Score:4, Interesting)
Rhino has been a part of the default Java distro since long before v8.
What I'd like to know is, how does this thing improve on Rhino? And can parts of it be reused in scripting engines for other languages? The article is pretty light on details.
Re: (Score:2)
Rhino runs an interpreter that first compiles JavaScript into its own pseudo-bytecode, and then interprets the pseudo-bytecode. I believe what Oracle is proposing is to compile JavaScript directly into Java bytecode, using the new features of the JVM to handle the dynamic aspects that weren't possible with previous versions of the JVM.
Re: (Score:2)
To nitpick, Rhino does/did supply a command line utility to compile scripts ahead of time to .class files. However, the Oracle included engine based on rhino doesn't expose this as an option.
Nevertheless, as you say, the Nashorn approach is almost certainly more efficient due to the JSR 292 improvements at the JVM level.
Re: (Score:1, Informative)
Re: (Score:2)
Re: (Score:2)
What history? Oracle's only prominent patent dispute is with Google. I remember Oracle suing some second-rate database company, but IIRC it was more about trade secrets than patent infringement. If anything Oracle is better known for dumping or abandoning the opensource projects it inherited from Sun, particularly OpenOffice and Solaris.
Re: (Score:2)
Oracle-Google case shows patent system flaws [sfgate.com]
Oh good going . . . (Score:5, Funny)
Re: (Score:2)
Re: (Score:2)
Now this will just make describing the differences between java and javascript even more painful . . . :P
Painful? It's easy: The only thing the languages have in common is the first four letters of their names. Outside of that, they're completely unrelated -- any apparent similarities are just a result of their common heritage of C-like syntax.
Backward compattibility (Score:1, Funny)
And we have known this since July 2011 (Score:5, Informative)
This was first discussed in July 2011 at the JVM Language Summit [jvmlangsummit.com] (PDF) link. It was discussed at the most recent JavaOne, and there have been more than a few articles about it.
Re: (Score:1)
What's different is that they're opening it (Score:5, Informative)
As the actual proposal [java.net] notes, while Project Nashorn has been in the works within Oracle for some time, what they're doing now is proposing to make it part of OpenJDK, to get more people working on it so that the code can be tightened up for production use.
Redemption Song (Score:2)
Too many "I"s
Re: (Score:2)
http://www.dailywritingtips.com/the-use-of-%E2%80%9Ci%E2%80%9D-in-first-person-narration/
Benefits . . . (Score:1)
Re: (Score:2)
Re: (Score:1)
Re: (Score:1)
Re: (Score:2)
Re: (Score:2)
Java has had an integrated Rhino fork for 6 years. I presume the aim with this new engine is to improve the experience for people who are already using it more than to attract people away from existing standalone JS engines.
Re: (Score:2)
Re: (Score:2)
Re: (Score:1)
Re: (Score:2)
I would run a mile from using Oracle hardware and database tech though unless I was totally convinced that I could only obtain the performance and reliability required by the project from using it.
Re: (Score:2)
Nashorn is German for Rhinocerus (Score:5, Informative)
Thought people should know
Why do they want this? (Score:2, Interesting)
If they just want a native general purpose scripting language for the JVM, then JS seems like a terrible choice.
At least, the work that goes into this project should benefit other dynamic languages on the JVM as well.
Re: (Score:3)
There's already a javascript interpreter from mozilla bundled with every JRE, so there must be some demand.
General purpose? I dunno. Sun were enthusiastic about JRuby (an original motivation for invokeDynamic) for a while but Oracle dumped the development team like a hot potato.
As for the business case, think node.js in the cloud hosted on, say, Oracle Weblogic.
Re: (Score:2)
JRuby is still alive and under active development but its main developers are no longer Sun employees.
At the time, Sun took an active interest in Ruby, hired JRuby programmers and built IDE support for it in Netbeans. Puzzlingly Oracle did an about face and removed it from Netbeans 7 while adding support for PHP.
Re: (Score:2)
One application would be plugins for various products (usually server-side). The core is Java but it allows for javascript modules/plugins to be added. Quite nice actually.
Not confusing at all! (Score:3)
Re: (Score:2)
This not new. Sun/Oracle JDK already has a js interpreter. It's the OpenJDK that doesn't. And some distros (like Ubuntu) only offer OpenJDK (unless add the repo yourself)
Re: (Score:2)
The Oracle JDK includes a package-mangled version of Rhino, I believe. The IcedTea flavour of OpenJDK included with Linux distros uses Rhino for JS too. From their FAQ:
"Works out of the box for javax.script javascript. IcedTea will use Rhino, a JavaScript in Java implementation, when it is installed on the system."
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
No trust in Oracle (Score:1)
Re: (Score:3)
Useful as a configuration language (Score:2, Insightful)
I have used Javascipt as the language of configuration files in a Java application. It replaced XML. It is a pleasure to work with Javascript for this purpose, much more comfortable than XML. I also considered YAML, but Javascript is more powerful and considering its ubiquity it does not need more learning.
However, I am not sure if real administrators would like Javascript in configuration files. At least it is standard, and has a good documentation, but the expressiveness of Javascript can be used in the
Re:Useful as a configuration language (Score:5, Insightful)
If you mean JSON; YAML (1.2 and up) is a superset of JSON.
I don't think you mean actual JavaScript in a configuration file and eval-ing that....
Re: (Score:3)
I do mean Javascript. Something like this:
It is similar to JSON, but notice the init function. This example creates a new Java (not Javascript) Car object, sets its driver and color attributes and starts the car when the application starts and stops it when the applicaton stops.
If in your particular configuration there are many such cars, than you are free to define your own Javascript function which can be used as a shortcut:
Re: (Score:1)
Oracle business strategy (Score:2)
Oracle? That's the company that just sued Google over Java. There are already several JavaScript engines for Java, and they'll be updated to use whatever non-proprietary JVM features Oracle deigns to add. So, the only real reason for Oracle to take the lead on this is that they want more control over JavaScript on Java and lock people more into their software "ecosystem". Thanks, but no thanks.
JDK6 already has one (Score:2)
Since JDK 6, the open source Mozilla Rhino [mozilla.org] Javascript engine is already built-in
Re: (Score:2)
node? (Score:2)
If you want server-side javascript, then why not just use node.js [nodejs.org], like everyone else is doing?
Re:node? (Score:5, Funny)
Node.js uses Google's V8 Javascript engine which is too fast for some applications. Also, it doesn't use enough memory, a problem the JVM is likely to correct. You can't expect much from an app that fails to allocate 900MB of virtual space and an 60MB working set on start-up.
Re: (Score:2)
and it won't be as secure as a JVM-based solution that has many, many years of engineering updates and patches applied to it already. In fact, a JVM-based implementation would be so secure there's a new patch being developed for it right now.
Re: (Score:1)
Or if you want to combine Java, JavaScript, and a few other scripting languages in a Node-like server, use Vert.x [vertx.io].
How about fixing Java instead? (Score:1)
Oh, you said Oracle? (Score:2)
Re: (Score:2)
They/we need the reverse. Anyone remember WORA? (Score:2)
A fully compliant JVM written in Js. Doppio is the most advanced one that I know of. http://int3.github.com/doppio/ [github.com]
Once complete, it will become instantly redundant, because the non ms browser vendors will put jvms back in the browser to speed things up.
And that's a good thing! This whole js only thing for the web is dumb. At some point in the future, it could be 0 years, 20 years, this will come about and we (you) will all slap our foreheads and go...OMG, we could have been writing our web apps in language
Why? (Score:1)
jrunscript.exe (Score:2)
On my Windows box I see jrunscript.exe - is that Rhino?
C:\Program Files\Java\jdk1.6.0_34\bin>jrunscript -?
Usage: jrunscript [options] [arguments...]
where [options] include:
-classpath Specify where to find user class files
-cp Specify where to find user class files
-D= Set a system property
-J Pass directly to the runtime system
-l Use specified scripting language
-e Evalu
Re: (Score:2)
Yes, it is a wrapper around rhino. On my Linux box
$ jrunscript -q
Language ECMAScript 1.7 implemention "Rhino" Rhino 1.7 release 3 2012 05 18
But it does in theory allow you to specify other scripting languages e.g. ruby if you add the necessary language runtime jars to the classpath.