Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Java Oracle Programming

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."
This discussion has been archived. No new comments can be posted.

Oracle Proposes New Native JavaScript Engine for OpenJDK

Comments Filter:
  • 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.

    • by Trepidity ( 597 ) <delirium-slashdot@@@hackish...org> on Monday November 26, 2012 @07:54PM (#42100053)

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

      • Re: (Score:2, Funny)

        by Anonymous Coward

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

    • Re: (Score:1, Informative)

      Give me a break, Chicken Little. Look at Oracle's history involving Java APIs though the JCP before spouting your FUD.
      • 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.
    • 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.

    • "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]
  • by Mitchell314 ( 1576581 ) on Monday November 26, 2012 @07:53PM (#42100045)
    Now this will just make describing the differences between java and javascript even more painful . . . :P
    • Well just to make the situation a bit clearer [ejohn.org]
    • 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.

  • As long as it is compile once, debug everywhere I am fine with it... :-D
  • by jockm ( 233372 ) on Monday November 26, 2012 @07:59PM (#42100083) Homepage

    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.

  • 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.
    • 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.
      • 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.
        • by dshk ( 838175 )
          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.
        • 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.
          • by pjt33 ( 739471 )

            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.

          • by DrXym ( 126579 )
            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.
            • 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.
      • by dshk ( 838175 )
        You know the costs, it is free, GPL v2.
      • by DrXym ( 126579 )
        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.

    • "highly dynamic"? Not sure what you mean by that. I've been writing highly optimized code for years without ever having to use 'eval'.
  • by Anonymous Coward on Monday November 26, 2012 @08:12PM (#42100191)

    Thought people should know

  • by glwtta ( 532858 )
    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.
    • 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.

      • by gaspyy ( 514539 )

        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.

  • by bennomatic ( 691188 ) on Monday November 26, 2012 @08:28PM (#42100311) Homepage
    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!
    • by gaspyy ( 514539 )

      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)

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

  • I wouldn't trust Oracle further than I could smell them.
  • 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

    • by John Bokma ( 834313 ) on Monday November 26, 2012 @09:35PM (#42100985) Homepage

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

      • by dshk ( 838175 )

        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("j

      • by dshk ( 838175 )
        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.
  • 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.

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

    • by DrXym ( 126579 )
      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.
  • 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)

      by TopSpin ( 753 ) on Monday November 26, 2012 @11:50PM (#42102023) Journal

      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.

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

    • by oever ( 233119 )

      Or if you want to combine Java, JavaScript, and a few other scripting languages in a Node-like server, use Vert.x [vertx.io].

  • 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.
  • Comment removed based on user account deletion
  • 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

  • Who in his right mind would use javascript when not forced to?
  • 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

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

Two can Live as Cheaply as One for Half as Long. -- Howard Kandel

Working...