Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Oracle Proposes New Native JavaScript Engine for OpenJDK

Unknown Lamer posted about 2 years ago | from the shiny-new-crap dept.

Java 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."

cancel ×

80 comments

Sorry! There are no comments related to the filter you selected.

Don't let them patent it! (0)

sageres (561626) | about 2 years ago | (#42100027)

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! (4, Informative)

Trepidity (597) | about 2 years ago | (#42100053)

There have also been standalone javascript engines running on the JVM; the best-developed is Rhino [mozilla.org] from Mozilla.

Re:Don't let them patent it! (2, Funny)

Anonymous Coward | about 2 years ago | (#42100219)

Nashorn is German for Rhinocerus .. So we wonder is this just another Rhino fork??

Re:Don't let them patent it! (1)

ChunderDownunder (709234) | about 2 years ago | (#42100657)

Nope, written from scratch.

Re:Don't let them patent it! (0)

Anonymous Coward | about 2 years ago | (#42100479)

Rhino is the current official javascript engine for java 8. Its included on the default java distro.

Re:Don't let them patent it! (3, Interesting)

M. Baranczak (726671) | about 2 years ago | (#42101159)

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:Don't let them patent it! (0)

Anonymous Coward | about 2 years ago | (#42102065)

Rhino is a JavaScript interpreter. The new features that the announcement claims this will use (InvokeDynamic, MethodHandles) are JVM technologies. If it is going to use those technologies, that would suggest that it will have some sort of compiler or JIT that will allow it to run significantly faster than Rhino.

Re:Don't let them patent it! (1)

REggert (823158) | about 2 years ago | (#42105193)

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:Don't let them patent it! (1)

ChunderDownunder (709234) | about 2 years ago | (#42111851)

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:Don't let them patent it! (1, Informative)

sethmeisterg (603174) | about 2 years ago | (#42100055)

Give me a break, Chicken Little. Look at Oracle's history involving Java APIs though the JCP before spouting your FUD.

Re:Don't let them patent it! (1)

Sussurros (2457406) | about 2 years ago | (#42100309)

sethmeisterg - the "off-topic" that you'll see against this comment which was later removed was from me. I brushed the track pad and then had to post a comment to remove the moderation that I never meant to post (I was going for overrated because Oracle is not a company on whose goodwill one should build any edifice). I apologise and thought you deserved an explanation.

Re:Don't let them patent it! (1)

aNonnyMouseCowered (2693969) | about 2 years ago | (#42100115)

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:Don't let them patent it! (1)

dgharmon (2564621) | about 2 years ago | (#42104251)

"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.

Oracle-Google case shows patent system flaws [sfgate.com]

Oh good going . . . (4, Funny)

Mitchell314 (1576581) | about 2 years ago | (#42100045)

Now this will just make describing the differences between java and javascript even more painful . . . :P

Re:Oh good going . . . (-1)

Anonymous Coward | about 2 years ago | (#42100337)

Just like explaining the difference between Christianity and what Jesus taught? I blame Athanasius.

Re:Oh good going . . . (1)

cheaphomemadeacid (881971) | about 2 years ago | (#42103321)

Well just to make the situation a bit clearer [ejohn.org]

Re:Oh good going . . . (1)

swillden (191260) | about 2 years ago | (#42105815)

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 (1, Funny)

Razgorov Prikazka (1699498) | about 2 years ago | (#42100059)

As long as it is compile once, debug everywhere I am fine with it... :-D

And we have known this since July 2011 (5, Informative)

jockm (233372) | about 2 years ago | (#42100083)

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.

What's different is that they're opening it (4, Informative)

PCM2 (4486) | about 2 years ago | (#42100667)

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.

Re:And we have known this since July 2011 (0)

Anonymous Coward | about 2 years ago | (#42101469)

Yes but this one is Parity News blog spam. Your links doesn't drive up page clicks and ad impressions that this blog spam link does.

Redemption Song (1)

dgharmon (2564621) | about 2 years ago | (#42104321)

"What do you know I wrote a novel [jockmurphy.com]"

Too many "I"s ...

Re:Redemption Song (1)

jockm (233372) | about 2 years ago | (#42142063)

http://www.dailywritingtips.com/the-use-of-%E2%80%9Ci%E2%80%9D-in-first-person-narration/

Benefits . . . (1)

Tontoman (737489) | about 2 years ago | (#42100171)

This will be most beneficial to tool builders. Also, maybe we won't have to use kludgy 'eval' so often when writing highly dynamic javascript.

Re:Benefits . . . (1)

Sussurros (2457406) | about 2 years ago | (#42100245)

Benefits versus risk. Oracle is not a company whose products I'd build a business on unless I knew the cost and had a signed agreement beforehand, The products are fine, the company is variable.

Re:Benefits . . . (1)

trev.norris (2010080) | about 2 years ago | (#42100465)

I'd also like to know what they mean by "lightweight JavaScript runtime". That must be completely subjective. If they are able to create a runtime that uses even close to the amount of memory v8 requires, I'll be impressed.

Re:Benefits . . . (1)

dshk (838175) | about 2 years ago | (#42100549)

I guess lightweight in this case means that they reuse the Java runtime library and most importantly the Java Runtime with its Just In Time compiler, so they do not add a huge code base to the standard Java deployment.

Re:Benefits . . . (1)

aztracker1 (702135) | about 2 years ago | (#42102041)

I'm curious as to what benefits this will offer over Node.js [nodejs.org] or Rhino [mozilla.org] . I mean my biggest aversion to Java has been the amount of boilerplate needed, to a lesser degree C# (.Net). Been really liking Node.js + MongoDB + WebStorm lately. Thinking of stripping down my API and pushing the base as a starting point framework for for building JSON web services.

Re:Benefits . . . (1)

pjt33 (739471) | about 2 years ago | (#42103165)

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:Benefits . . . (1)

DrXym (126579) | about 2 years ago | (#42103895)

The benefit would be faster performance while offering the ability to mix and match JS with Java. Since they run on the same JVM you could call from an object implemented in one language straight through to an object implemented in another. e.g. use node.js like code to service a web request but pulling the data through domain objects filled from a hibernate store. A bit like how Groovy, Jython and other JVM based languages work.

Re:Benefits . . . (1)

aztracker1 (702135) | about a year and a half ago | (#42170461)

Faster performance than Node.js? I will say I get the desire to utilize both environments... however, I feel that mixing the two would likely add a lot of additional complexity and that a service layer with predictable interface could work better for scalability. I know it can be pretty cool, just seems like the efforts would be better served elsewhere, unless they implement support for say NPM or AMD based modules and can re-use a lot of what's been written.

Re:Benefits . . . (1)

dshk (838175) | about 2 years ago | (#42100477)

You know the costs, it is free, GPL v2.

Re:Benefits . . . (1)

DrXym (126579) | about 2 years ago | (#42103833)

I think Java is the exception to that since if for some reason you don't like Oracle's Java (which is free and ubquitous) there are a number of other licenced implementations in software and hardware plus an open source version. And numerous app servers, web servers, frameworks, persistence models etc.

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:Benefits . . . (2)

trev.norris (2010080) | about 2 years ago | (#42100435)

"highly dynamic"? Not sure what you mean by that. I've been writing highly optimized code for years without ever having to use 'eval'.

Nashorn is German for Rhinocerus (5, Informative)

Anonymous Coward | about 2 years ago | (#42100191)

Thought people should know

Re:Nashorn is German for Rhinocerus (0)

Anonymous Coward | about 2 years ago | (#42102399)

Interesting that they chose to translate a misspelling.

Why do they want this? (1, Interesting)

glwtta (532858) | about 2 years ago | (#42100307)

We're stuck with JavaScript in webapps (where there are plenty of excellent implementations already), but the JVM has little to do with that.

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:Why do they want this? (2)

ChunderDownunder (709234) | about 2 years ago | (#42100759)

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:Why do they want this? (0)

Anonymous Coward | about 2 years ago | (#42101491)

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.

I like playing with Ruby, and it powers some pretty neat devopsy software I work with, but you'd have to be very, very, very, very brave to implement a Ruby interpreter.
It'd be right up there with trying to implement a Perl interpreter.

http://en.wikipedia.org/wiki/Ruby_MRI
"Until the specification of the Ruby language in 2011, the MRI implementation was considered the de facto reference."
Probably has a _LITTLE_ to do with the decision :\
It's too bad though, having a second, serious implementation would bring a lot of good to the project.

Re:Why do they want this? (1)

ChunderDownunder (709234) | about 2 years ago | (#42103541)

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:Why do they want this? (1)

gaspyy (514539) | about 2 years ago | (#42102733)

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! (2)

bennomatic (691188) | about 2 years ago | (#42100311)

I'm sure that this won't make lay-person misunderstandings of the difference between Java and Javascript worse at all! At all! AT ALL!

Re:Not confusing at all! (1)

gaspyy (514539) | about 2 years ago | (#42102753)

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:Not confusing at all! (1)

ChunderDownunder (709234) | about 2 years ago | (#42103569)

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."

Dead horse: stop beating it (0)

Anonymous Coward | about 2 years ago | (#42104025)

I'm sure that this won't make lay-person misunderstandings of the difference between Java and Javascript worse at all! At all! AT ALL!

Welcome to 1996.

The lay-person has never heard of Java, has no reason to ever have heard of Java. Most definitely has no reason to have Java installed. Java is dead. Someone call the PETA and report this gratuitous beating of a dead horse.

Re:Dead horse: stop beating it (1)

schroedingers_hat (2449186) | about 2 years ago | (#42104191)

No man, Java is the new COBOL, there's gunna be people maintaining and expanding on all the enterprisey java stuff for centuries.

Re:Dead horse: stop beating it (1)

bennomatic (691188) | about 2 years ago | (#42106311)

True dat. And sometimes building on their favorite flavor of Java. I can't tell you how often I've heard, "We can't install anything later than 1.4.2 because doing so will break X, Y, or Z application."

Re:Dead horse: stop beating it (1)

bennomatic (691188) | about 2 years ago | (#42106295)

Totally not true. Enterprise IT people are still jumpy about Java and applets because of, well, the legacy of 1996. So it's not uncommon for individuals in such an enterprise--who've been beaten over the head about running applets or installing Java a million times--to get very concerned when you tell them that the web application that they're running relies on Javascript for many of its features. I know this for a fact; I've done consulting work for a significant number of large enterprise (5k-150k employees) in the context of web application performance, and *at least* once a week, we have someone raising concerns about installing Java--or at least a fear that they'll have to install a specific version of Java--when we discuss Javascript.

The one and only thing I like about C# is that nobody confuses it with Javascript. Of course, it's got its own namespace issues...

More please (0)

Anonymous Coward | about 2 years ago | (#42100315)

This is exactly what we need: more ways to run exploit code natively from web sites. C'mon now. /sarcasm

No trust in Oracle (1)

Fuzi719 (1107665) | about 2 years ago | (#42100331)

I wouldn't trust Oracle further than I could smell them.

Re:No trust in Oracle (2)

mark-t (151149) | about 2 years ago | (#42101497)

So... pretty far, then?

The Point? (-1)

Anonymous Coward | about 2 years ago | (#42100355)

What is the point of a stand alone javascript engine? So shitty webdevs can write horrible stand alone apps in a scripting language?

Now, if this were some attempt to build a modular Javascript engine that could be plugged in to browsers to create only one buggy JS runtime to deal with instead of dozens, that could be useful.

Useful as a configuration language (2, Insightful)

dshk (838175) | about 2 years ago | (#42100423)

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 wrong way too.

Re:Useful as a configuration language (4, Insightful)

John Bokma (834313) | about 2 years ago | (#42100985)

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:Useful as a configuration language (3)

dshk (838175) | about 2 years ago | (#42101879)

I do mean Javascript. Something like this:

init(Car, {
  driver: "john@example.com",
  color: "red"
});

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:

addCar("john@example.com", "red");

The administrator is allowed to bend the configuration syntax to his situation. And this power is almost free, the integration between Java and Javascript only requires a few lines of code in the application. For example you do not need to modify the source code of Car in the above example.

Re:Useful as a configuration language (1)

dshk (838175) | about 2 years ago | (#42103951)

For the sake of moderators, who still mods up this - indeed helpful, conditional - correction, even after I wrote that it was wrong: No, the assumption is invalid, I do mean JavaScript.

They can't even keep their forums up. (0)

Anonymous Coward | about 2 years ago | (#42100497)

Down at least an hour as of this writing. Yeah, it's stupid jive software, but still.

Should be jailed (0)

Anonymous Coward | about 2 years ago | (#42100899)

Spreading javascript is an act of aggression against all programmers. They should be jailed.

No puns about being chrooted in jail will be made. Thank you.

Oracle business strategy (1)

kenorland (2691677) | about 2 years ago | (#42101025)

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.

Re:Oracle business strategy (0)

Anonymous Coward | about 2 years ago | (#42101343)

Exactly!

JDK6 already has one (2)

m0RpHeus (122706) | about 2 years ago | (#42101387)

Since JDK 6, the open source Mozilla Rhino [mozilla.org] Javascript engine is already built-in

Re:JDK6 already has one (1)

DrXym (126579) | about 2 years ago | (#42103907)

Rhino is an interpreter though. Sounds like they want something which compiles JS to actual bytecode and is therefore faster. Perhaps the effort required to make Rhino work the way they want is so high it's easier to write something from scratch.

node? (1)

smcdow (114828) | about 2 years ago | (#42101639)

If you want server-side javascript, then why not just use node.js [nodejs.org] , like everyone else is doing?

Re:node? (4, Funny)

TopSpin (753) | about 2 years ago | (#42102023)

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:node? (0)

Anonymous Coward | about 2 years ago | (#42103313)

Or an app that has less than 500ms startup time like the JVM. It's just not 'enterprise' enough.

Re:node? (1)

gbjbaanb (229885) | about 2 years ago | (#42104685)

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:node? (1)

oever (233119) | about 2 years ago | (#42102175)

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? (1)

cheesybagel (670288) | about 2 years ago | (#42101745)

Perhaps we could get fonts that don't suck in all applications without reprogramming. Or improved GUI performance. Or those bugs which are on your database for nearly a decade which never get fixed. Or LINQ. Or unsigned types. No instead we get a new Javascript VM. As if there weren't enough infection vectors already. Thanks Oracle.

Oh, you said Oracle? (1)

gtirloni (1531285) | about 2 years ago | (#42101939)

Don't care.

weve done this shit (1)

nimbius (983462) | about 2 years ago | (#42102595)

before when microsoft decided it would be a really swell idea to have C#, jscript, mono and a host of other shitty analog lock-ins that solve a problem no one has. I guess its never too early to reinvent the wheel.

Javascript with all the JVM crapness (0)

Anonymous Coward | about 2 years ago | (#42103299)

Oh great. A javascript implementation that sucks as much as the JVM. What the world has always wanted.

They/we need the reverse. Anyone remember WORA? (1)

digitaltraveller (167469) | about 2 years ago | (#42103567)

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 (insert favourite here) X this whole time? What were we thinking.

JS is being compiled and minified and closured away. JVM is open, it's bytecode. It can run anywhere. Let's let go of this fiction that its somehow good or more open to have a single client side web language.

Why? (0)

Anonymous Coward | about 2 years ago | (#42104351)

They're doing this because they need to get developers back. A lot of developers are moving away from Java and to languages like JavaScript. This is Oracle's attempt to bring them back.And they're actually working on their own version of Node.js, called Node.java.

Old News (0)

Anonymous Coward | about 2 years ago | (#42104373)

This is actually old news, they've been talking about it for two years, and the actual implementation of it is pretty well done. they were showing it off at JavaOne this year. The only new thing is that they want to put it in the OpenJDK.

Vaporware (0)

Anonymous Coward | about 2 years ago | (#42105639)

Oracle has proposed a new project for OpenJDK — Nashorn, which aims to implement a high-performance yet lightweight...

"Oracle" and "lightweight" in the same sentence? This will never happen.

Why? (1)

faustoc4 (2766155) | about 2 years ago | (#42106661)

Who in his right mind would use javascript when not forced to?

jrunscript.exe (1)

hey (83763) | about 2 years ago | (#42106847)

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 Evaluate given script
    -encoding Specify character encoding used by script files
    -f Evaluate given script file
    -f - Interactive mode, read script from standard input
                                              If this is used, this should be the last -f option
    -help Print this usage message and exit
    -? Print this usage message and exit
    -q List all scripting engines available and exit

If [arguments..] are present and if no -e or -f option is used, then first
argument is script file and the rest of the arguments, if any, are passed
as script arguments. If [arguments..] and -e or -f option is used, then all
[arguments..] are passed as script arguments. If [arguments..], -e, -f are
missing, then interactive mode is used.

Re:jrunscript.exe (1)

ChunderDownunder (709234) | about 2 years ago | (#42111651)

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.

Check for New Comments
Slashdot Login

Need an Account?

Forgot your password?

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>