If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Oracle Wants To Embed JavaScript In Java Code

Phoronix: Oracle Wants To Embed JavaScript In Java Code

Oracle presented a new project in recent names that is named Nashorn. The Nashorn Project comes down to a high-performance JavaScript run-time for OpenJDK and can be used so developers can embed JavaScript within Java code...

I too would like to know why they intend to do this. I'm not sure what the gain would be to implement JavaScript. I'm not saying its a dumb or bad idea, because I don't understand the intention of it. Java is more advanced than JS and while i haven't dealt with either that much, I found Java to be overall easier to use as a language. JS is naturally relatively disorganized.

I guess they just want to make it easy to run some scripts directly from applications (i.e. letting the user configure something).

And btw what a fantastic name... A Java based JS engine called Rhino has existed for ages, now they call it Nashorn (= Rhino in German).
But since it uses the invokedynamic bytecode which was introduced with Java 7 it might even be pretty well perfoming.
The Java VM could even be a viable choice for dynamic languages

I too would like to know why they intend to do this. I'm not sure what the gain would be to implement JavaScript. I'm not saying its a dumb or bad idea, because I don't understand the intention of it. Java is more advanced than JS and while i haven't dealt with either that much, I found Java to be overall easier to use as a language. JS is naturally relatively disorganized.

There's a pattern called fluid logic tha could use just that. I'm not saying that's why they're doing, but there is at least one reason.

Why? Why does Oracle want to put JavaScript in Java?
JavaScript have nothing to do with Java, except being similar in name.

They should make 'var' keyword declaration like in C# and add collection initializers for stuff like List, ArrayList, etc.

Because there's a lot of interest in using scripting languages on JVM, to the point of having enhancements to the last few JVM releases to improve performance for those cases. And Javascript is the standard client-side scripting language for web apps, and Oracle obviously see people wanting to use the same scripting language on both frontend and backend. The popularity of things like Node.js suggests they might be right.