Replacement for Java Nashorn - java

I'm not asking what the alternatives are. But, what's the "official" line on what to do about Java Nashorn deprecation now (December 2019). Are you supposed to just wait. Is graalvm to become part of the JDK or are the parts of it that are needed for Javascript support going to be part of the JDK or what? Am I going to need to pay for graalvm enterprise (just to have Javascript like I had before through Nashorn in a closed source application) is that where Oracle is taking this?

Related

How to build OpenJDK with Emscripten?

I am trying to use Emscripten's emconfigure and emmake to compile OpenJDK for the web. The end goal would be to be able to run uncompiled java code natively in the browser. However, running emconfigure ./configure throws the error
configure: The C compiler (located as /usr/lib/emscripten/emcc) does not seem to be the required gcc compiler.
configure: The result from running with --version was: ""
configure: error: A gcc compiler is required. Try setting --with-tools-dir.
I have been searching all day and I haven't found anything along the lines of this error. Is there any easy workaround for this? Should I even be trying to build OpenJDK this way?
Is there any easy workaround for this?
I doubt it. If you look at (for example) jdk11u/make/autoconf/toolchain.m4 you will see the toolchains that are supported on various platforms. Emscripten is not listed.
I expect that emconfigure is trying to use the JDK's autoconf-based configuration framework. And that framework is checking the compiler you are trying to use ... and saying Nope!
You may be able to modify the auto-conf macros to support the Emscripten tool chain. But the next problem will be getting the code to actually compile. And then to getting it to run.
Should I even be trying to build OpenJDK this way?
It is not up to us to say what you should do.
However, I would make some observations.
If you are expecting this to work without significant effort, you are sadly mistaken.
What you are doing is equivalent to trying to port Java to a new OP platform and hardware platform. This is is a massive project. In addition to just getting the JVM to compile, you also have the problem of getting the Hotspot JIT compiler to generate WebAssembly code.
This is probably a bad idea anyway. Once upon a time, mainstream web browser vendors did support Java in the browser. But there were so many "security issues" that (virtually) all vendors have dropped support. Oracle saw the writing on the wall, and in Java 9 they started the process of removing support from the OpenJDK codebase. Applet support and JNLP are gone, and they are planning to get rid of the SecurityManager framework.
What you would be doing is bring back Java support in the web browser ... with the security safeguards stripped out.
Basically, the Java SE platform is to rich to implement securely in a web browser.
If you are still keen on building a JVM using Emscripten, take a look at https://github.com/emscripten-core/emscripten/issues/3342.
But note that they are talking about building JamVM, which is Java 1.6, and hasn't been touched since 2014.

Is JRE and JVM the same for Enterprise Edition of JAVA?

I can imagine JDK to be different at least between JAVA SE and JAVA EE. Are JRE and JVM different too? I researched about this in internet for a longtime and could not find clear answer. It was either only focussed on explaining difference between JDK, JRE and JVM or only the API and functional difference between SE and EE.
I see there are multiple open source server implementations like Tomcat. How are they giving out the JAVA EE jar (servlet-api) ?
Is this even a valid question to think about? Or I have had something misunderstood?
the answer is that JVM and JRE are the same used for JSE and JEE, to be more clear, what is JEE? JEE is a set of java classes and interfaces and annotations, of course with a container (application server).

When Java 6 will be dropped will my application continue to work?

I am a bit worried about something and no matter how much i searched i could not find something or i could not search properly.
I have an application that runs on java 6 SE. Oracle mentions in the website that they will drop the Java 6 SE Deployment in June 2017. So that leaves me with a question. Will my application still run after the Java 6 end or will it crash?
Deployment Technology for Java SE 6 will be available until Jun 2017
Mentioned here
Will my application still run after the Java 6 end or will it crash?
It will continue to run.
If a user downloads and installs a Java 6 JRE / JDK, your application will run as before.
If a user has Java 7, Java 8, Java 9 .... etcetera, your application will run on those platforms provided that it is properly written. Things that might cause it to break include:
dependencies on restricted "internal" classes that have been changed or removed in a later release,
incorrectly written multi-threaded code that breaks due to platform differences,
a tiny number of documented incompatibilities, and
dependencies on 3rd-party libraries that have not been ported.
However ....
You ought to take the time to port your application to run on the latest version of Java. This is probably just a matter of compiling the codebase on the newer / newest Java JDK, and then running all of your unit and system tests. (But if you have extensive dependencies on old libraries that are no longer being maintained, then you may have a problem ...)
If you don't do this, your application is liable to become problematic for users who won't or cannot install an out-of-date (and probably insecure!) version of Java on their systems.
This is even more important for applications that depend on web deployment and Java plugins for browsers.
Yes. No. Maybe.
If you continue to use old JVM nothing will changes. Except you won't get bugfixes and security patches.
If you migrate to new JVM then in theory all should be fine (Java declare backward compatibility), but sometimes problems may occur. That's why you need to test you application with new JVM before you go into production.
As mentioned by some of the others, yes your application will still work. It just means they will be done supporting it.
Oracle’s poor wording is ambiguous
To answer the specific part of your question, let's look at the text of the Oracle page, Oracle Java SE Support Roadmap (retrieved 2016-10).
Support of Deployment Technology
The web deployment technology, consisting of the Java Plugin and Web Start technologies, has a shorter support lifecycle. For all major releases of Java SE starting with Java SE 7, Oracle provides five (5) years of Premier Support for these technologies. Extended Support is not available for the deployment stack. See the Oracle Lifetime Support Policy for details.
Deployment Technology for Java SE 6 will be available until Jun 2017.
This says that for (a) the Java Plugin for Java applet and for (b) Java Web Start specifically you cannot purchase additional technical support from Oracle beyond 2017-06. Other Oracle extended support contracts running beyond that date do not include technical support for the Java SE 6 version of this pair of deployment technologies.
That last sentence is poorly worded. I believe we can assume it should have begun with “Technical support for”. I understand the cause for your Question here.
As others have said, Oracle has never time-bombed any Java technology product nor have they ever announced any plans for doing so.
Oracle support for the plugin and for applets is practically moot as various operating systems and web browsers in recent years have been limiting or ending their support for Java applets due to security vulnerabilities. Java Web Start remains a viable platform for distributing local Java apps, though I recommend such apps move to later versions of Java.

Javascript engine can not be found - scripting for the Java platform

Recently some of my users have been reporting problems with NullPointers. Thanks to one of them, I have managed to find out that my application can't find the Javascript engine that should theoretically come with the JRE (most of them have the JDK anyway).
How can they manually install the scripting engine?
Thanks in advance...
P.S. Most of these people have OpenJDK. However, this doesn't happen to me (I am also an OpenJDK user)...
EDIT: They have at least version 1.5, most of them have 1.6.
From JSR 270 (the Java 6 SE spec):
There will be no requirement that any
particular scripting language be
supported by the platform;
implementors may choose to include
support for the scripting language(s)
of their choice as they see fit.
So, it is conceivable that there are JREs out there without JavaScript support. There may also be variations in engine names, language names and versions bundled. "JavaScript" is an Oracle trademark so some vendors might be reluctant to use it as an identifier string.
The Rhino engine has only been bundled with Java since Java 6. Thus, your Java 5/1.5 users won't have it preinstalled.
That said, you can get Rhino, the Javascript engine, manually from Mozilla's site, since the engine itself does work with Java 5. However, you will have to use Rhino's API, rather than working with Java's ScriptEngine interface.

Fastest Java-based Javascript Engine

I'm currently using the javax.script package for interpreting and executing Javascript code on the fly. Incidentally, this is the same engine used by Mozilla's Rhino JS interpreter.
Question: is there any Java-based Javascript Engine that is faster than Rhino?
In Java 8, Oracle plan to release Nashorn, which is their own JavaScript engine built into Java. It plans to be much faster than Rhino, and aims to be the reference implementation of JavaScript in Java for the future.
See a recent interview about it with Oracle # DZone:
If you are happy to use a pre-release JDK, you can download it here.
I haven't heard of any Rhino alternatives. According to this list: http://en.wikipedia.org/wiki/List_of_ECMAScript_engines, Rhino is the only Java-based JavaScript interpeter.
javax.script is way older (and slightly modified) than the current version of Mozilla's Rhino which you can download from the Internet. Have you tried getting the latest Rhino and using that?
Also depending on for what you're using it and what kind of integration you require, using node.js may be more suitable for you.

Categories

Resources