7 ms·
JEP 335: Deprecate the Nashorn JavaScript Engine
- _bxg1 8y agoI'm not very familiar with Nashorn, but could they just create a thin Java compatibility layer and outsource the bulk of the work to V8? Are there license issues with shipping V8 alongside Java?
- zackangelo 8y agoI don't know if this implements the javax.script API, but it does allow you to embed V8 in Java programs: https://github.com/eclipsesource/J2V8 https://github.com/eclipsesource/J2V8
- pjmlp 8y agoThere was a talk about that at last Java ONE, I think, but there are no more news about it.
- paulddraper 8y agoIt's possible. It wouldn't run on the JVM, with JVM gc, JVM security, JVM in-process latency, etc. The biggest problem is the latency, but yeah separate V8 works alright.
- hinkley 8y agoI thought Nashorn was part of this agenda of keeping the JVM relevant even if Java becomes less so. I would guess Graal has something to do with this housecleaning.
- kjeetgill 8y agoThe author of this proposal, Jim Laskey, is also the one behind exactly what you're describing: Project Detroit. see: http://openjdk.java.net/projects/detroit/ http://openjdk.java.net/projects/detroit/ speculation: It looks like he wants Nashorn dead from any angle? GraalJS and V8, lol
- jarym 8y agoYup, if Jim is behind this then I am more trusting of the technical reasons. I can't wait for the first release of Detroit - very exciting!
- jnermut 8y agoI’m wondering why Project Detroit, and the background given in the Jim Laskey preso about it, isn’t mentioned in the JEP. I’m sure it would help quell the outrage. That project will basically be Nashorn compatible, with better performance and ES6 and Node support. I wonder how it relates to Graal and TruffleJS though. Seems a bit left hand/right hand from Oracle to have competing projects like this. For anyone interested in JS on the JVM Jim’s video is a must watch: https://www.youtube.com/watch?v=-JLhwsbMvjQ https://www.youtube.com/watch?v=-JLhwsbMvjQ
- jupp0r 8y agoTLDR: With the rapid pace at which ECMAScript language constructs, along with APIs, are adapted and modified, we have found Nashorn challenging to maintain.
- pitaj 8y agoPlease don't quote with code blocks. It forces horizontal scrolling which is a huge pain especially on mobile. > Just use quote arrows to signify instead
- kodablah 8y agoCan someone give some background on the reasoning? I'm glad it's not completely Oracle's call. I see this as a power move. Nashorn is part of OpenJDK, which is becoming less and less Oracle-specific. Graal/Truffle however are squarely under Oracle's umbrella. > With the rapid pace at which ECMAScript language constructs, along with APIs, are adapted and modified, we have found Nashorn challenging to maintain. [...] GraalJS using Oracle Labs' Truffle technology may soon be publicly available as a Java module. It is understood that GraalJS provides most of the same functionality as Nashorn along with better performance. So, one is too challenging to maintain but the other isn't? Why don't you just come out and say it? You are shifting resources to your more proprietary impl that you have a premium version of. And if no other OpenJDK maintainers want to step up and maintain Nashorn, I say remove it. But everyone should be clear about Oracle's motives here. I expect we'll start seeing this more and more like we do with mission control...Oracle is going to dedicate fewer and fewer resources to OpenJDK, the Oracle version of which no longer carries reasonable benefits on its own. More ancillary products around the JVM will be focused on. Makes sense, but I sure wish an alternative Oracle-effort-sized OpenJDK maintainer existed. And for those of you that have used Nashorn and need it to do work, remember what is happening here. And those of you starting the same thing with Graal/Truffle, watch what is happening here. Lots of us work w/ the core of the JDK, but beware of building new products on Oracle tech.
- tetha 8y agoWhat actual reason is there to build anything new on oracle? MySQL is obsoleted by one of MariaDB, Postgres or Galera, especially for new things - and in my book, OracleDB is as well for new things. The OpenJDK supplies enough java to build big things and even the use of java might be debated. This changed during the last decade, but at this point, oracle thrives on things large corporates depend upon. There is no reason to start anything outside of a large enterprise with Oracle investment with any oracle dependency. Quite the opposite.
- deleted 8y ago[deleted]
- flafla2 8y ago
- foobarbazetc 8y agoSigh... we just built a whole new service with Nashorn.
- sigzero 8y agoI was thinking of going that way as well. sigh
- Touche 8y agoMind sharing why you picked Nashorn?
- sigzero 8y agoI was mostly going that way because we will be moving to Java 8 and it came with. I saw the possibilities of using it to do utilities etc. My environment is very restrictive and I can't get things installed easily, so because it comes with, that was a bonus.
- foobarbazetc 8y agoWe built a user scripting feature for our product (like Google App Script). Our backend is entirely written in Scala so hooking up JS to our Scala stuff was really, really simple with Nashorn. The tricky bits are all the hacks to limit resource usage which took a bunch of engineering time to implement and test and aren’t reusable across engines. It’s not the fastest or the latest or whatever but it works well and gets the job done.
- vorg 8y agoIf you wanted a user scripting feature and not Javascript in particular, then couldn't you embed the Scala REPL with appropriate resource usage limits? You can using Apache Groovy which is used by Gradle and Jenkins Pipelines. Of course Scala and Javascript are both rising in adoption, whereas Groovy is fast sinking so you probably wouldn't want to go that way.
- 8y ago
- kaixi 8y agoWhat a shame. With Spring you could switch from traditional Java based templates to server-side rendering React templates without changing your controllers.
- pradn 8y agoHas anyone used Nashorn? For what use-cases did it make sense to run JS inside of a JVM process?
- adrianpike 8y agoJS in the JVM is used heavily in Mirth (https://www.nextgen.com/products-and-services/integration-engine https://www.nextgen.com/products-and-services/integration-en...) for scripting of channels and data transformations. It's kinda janky but runs a lot of healthcare systems. It's using Rhino, not Nashorn, FWIW.
- kenan_warren 8y agoI know of one CMS that uses it extensively underneath to construct the pages.
- MrBuddyCasino 8y agoYeah Alfresco. Was a stupid idea, second only to their decision to roll their own crappy UI framework.
- lmm 8y agoUser-defined scripting of a system written in Java. Everyone knows Javascript and it's easier to allow a user to submit text scripts and run them via the embedded engine than require users to run some kind of plugin build process.
- Roboprog 8y agoWe are. We use a library called rules.js to do some basic content validations that can run on either/both the client and server. And now I look foolish for suggesting it (using Nashorn).
- Fishkins 8y agoI use it for server-rendering React in a Spring app
- jameshart 8y agoIs there any relevance to this to the fact that Oracle owns the trademark on JavaScript? Usually trademarks are only maintained through use; if Oracle stops distributing a JavaScript implementation, could they lose the trademark?
- deleted 8y ago[deleted]
- bitmapbrother 8y agoOracle recently had Apple pull an app from the App Store because it had the word JavaScript in the name. So they are vigorously defending the trademark. https://news.ycombinator.com/item?id=16862949 https://news.ycombinator.com/item?id=16862949
- AgentK20 8y agoSince when do new systems get integrated into Java, then officially deprecated for removal less than 5 years later? New technologies take time to be integrated into existing stacks, and new projects take time to come to market. I recognize that it's a lot of work to keep up with the ECMAScript language, but even if the ECMAScript language support lags behind official, that's better than removing a component that was hyped up in the Java 8 release. My team uses the Nashorn engine as a sandboxed scripting engine in an upcoming game. Because of the nature of the transpiling of javascript into Java, we've got very granular control over what classes, fields, and methods can be accessed from the javascript context. I'm not sure at this point what we're going to do about this, so I'm looking at things like GraalJS. Anyone have any experience with a use case like ours?
- kjeetgill 8y agoI'm not that familiar with Nashorn but the Truffle framework on which GraalJS is built has considerations for sandboxing. see: hostClassFilter() https://github.com/oracle/graal/blob/master/sdk/src/org.graalvm.polyglot/src/org/graalvm/polyglot/Context.java#L835 https://github.com/oracle/graal/blob/master/sdk/src/org.graa... I suspect that your use-case might be easier to port than most (if it comes to that) since you probably aren't using as many platform APIs. I agree that the volatility in java-land is new and unsettling and Nashorn is pretty young to be removed but the js ecosystem itself has been changing fast lately. I hope they keep Nashorn around even of they don't keep up with newer language versions.
- kjeetgill 8y agoQuestion for those in the know: What are the Nashorn specific APIs and that would break in a move to graaljs? Presumably all of the pure js code would still be compatible with any js implementation but java/js interop and platform apis specific to nashorn would break. How big of an api surface is this really?
- chrisseaton 8y ago> but java/js interop ... specific to nashorn would break I think GraalJS implements the same Java/JS interop API.
- kjeetgill 8y agoThat's good news then. If they're is some effort to spec out the Nashorn API and regression test those parts against GraalJS they'd probably benefit from branding it as Nashorn 2.0 or at least Nashorn API Compatible to assuage all the fear.
- ozten 8y agoAlternatives section is light. Another option is to freeze Nashorn at ECMAScript-262 5.1 and not chase new ES versions.
- sparky_ 8y agoSeems pretty reasonable, given the availability of JS transpilers to target older ECMAScript implementations (Babel, for instance)
- exabrial 8y agoIs anyone making serious use of nashorn?
- lorenzosnap 8y agoNashorn is the beating heart for https://github.com/lorenzoongithub/nudge4j https://github.com/lorenzoongithub/nudge4j Around 100 stars in github so probably not worth much consideration to whoever decided to 'deprecate it' Again, nudge4j is effectively 8 lines of Java code (just enough to kick off the nashorn engine) and the rest is JavaScript on Java. I hope that JEP 335 won't go ahead. I vote against.