Slashdot Mirror


Oracle Proposes New Native JavaScript Engine for OpenJDK

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

16 of 80 comments (clear)

  1. Oh good going . . . by Mitchell314 · · Score: 4, Funny

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

    --
    I read TFA and all I got was this lousy cookie
  2. Re:Don't let them patent it! by Trepidity · · Score: 4, Informative

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

  3. And we have known this since July 2011 by jockm · · Score: 5, Informative

    This was first discussed in July 2011 at the JVM Language Summit (PDF) link. It was discussed at the most recent JavaOne, and there have been more than a few articles about it.

    --

    What do you know I wrote a novel
  4. Nashorn is German for Rhinocerus by Anonymous Coward · · Score: 5, Informative

    Thought people should know

  5. Re:Don't let them patent it! by Anonymous Coward · · Score: 2, Funny

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

  6. Not confusing at all! by bennomatic · · Score: 2

    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!

    --
    The CB App. What's your 20?
  7. Useful as a configuration language by dshk · · 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 wrong way too.

    1. Re:Useful as a configuration language by John+Bokma · · Score: 4, 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....

    2. Re:Useful as a configuration language by dshk · · Score: 3

      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.

  8. Re:Benefits . . . by trev.norris · · Score: 2

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

  9. What's different is that they're opening it by PCM2 · · Score: 4, Informative

    As the actual proposal 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.

    --
    Breakfast served all day!
  10. Re:Why do they want this? by ChunderDownunder · · Score: 2

    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.

  11. Re:Don't let them patent it! by M.+Baranczak · · Score: 3, 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.

  12. JDK6 already has one by m0RpHeus · · Score: 2

    Since JDK 6, the open source Mozilla Rhino Javascript engine is already built-in

    --
    Take-off every .sig! For Great Justice!
  13. Re:No trust in Oracle by mark-t · · Score: 2

    So... pretty far, then?

  14. Re:node? by TopSpin · · Score: 4, 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.

    --
    Lurking at the bottom of the gravity well, getting old