News for hackers. Stuff that matters.
Re:Java 11 released by gw on Tuesday September 25, 2018 @03:06PM (#18069427)
One setback with this release is that the javapackager tool, which made native installers that bundled the Java runtime, was removed (presumably because it depended on JavaFX) and there is no replacement for it. One is being proposed at http://openjdk.java.net/jeps/343 but I'm not sure when that is expected to be done.
Re:Java 11 released by ptx on Tuesday September 25, 2018 @04:23PM (#18070177)
You can replace it with separate components:

* Run jlink manually (or scripted) to create the bundled runtime.

* Create launcher executables with packr[1].

* Create the installer using whatever tools people normally use for native applications. NSIS[2] and WiX[3] are widely used. (I haven't gotten to this step yet myself.)

[1] https://github.com/libgdx/packr

[2] http://nsis.sourceforge.net/

[3] http://wixtoolset.org/

Re:Java 11 released by jontro on Tuesday September 25, 2018 @04:34PM (#18070259)
I was positively surprised when I noticed how easy it is to create a windows installer using nsis from osx. makensis is cross platform and can be integrated easily in the build toolchain
Re:Java 11 released by the8472 on Tuesday September 25, 2018 @03:12PM (#18069481)
If your application doesn't do bytecode generation or instrumentation at runtime then the graal native image compiler might do the job too or even better.

https://www.graalvm.org/docs/examples/native-list-dir/

Re:Java 11 released by gw on Tuesday September 25, 2018 @03:33PM (#18069713)
It looks like that makes a native executable, not a package meant for end users. The javapackager tool actually built .exe, .app, .deb, and other OS-specific packages.
Re:Java 11 released by xienze on Tuesday September 25, 2018 @03:19PM (#18069547)
> If your application doesn't do bytecode generation or instrumentation at runtime

I believe it also has trouble with reflection involving class names that aren't effectively constant at compile-time. So with that and the other limitations, there's a whole lot you can't do. Hopefully they can resolve that.

Re:Java 11 released by the8472 on Tuesday September 25, 2018 @03:28PM (#18069670)
I don't think they intend to solve that because the cases that it can't handle are basically application servers, plugin-based applications and the like. They violate the closed world assumption which graal's native image builder relies on.

Those are better served by a full JVM, optionally boiled down with jlink or with AOT compilation for faster startup, and the JEP that was mentioned upthread.

Re:Java 11 released by pjmlp on Wednesday September 26, 2018 @02:44AM (#18073318)
This limitation also exists in other languages that have reflection.

In .NET Native and Lisp for example, you need to list code that should be kept around and not removed by the linker.

It is not an easy problem to sort out in some kind of automatic way.

Re:Java 11 released by calcifer on Tuesday September 25, 2018 @03:25PM (#18069626)
> reflection involving class names that aren't effectively constant at compile-time

Can you give an example?

Re:Java 11 released by xienze on Tuesday September 25, 2018 @03:34PM (#18069724)
Sure, just about any project that has the concept of plugins. At runtime the code looks for plugin instances by searching for, e.g., META-INF/services/<interface_name> on the classpath. Inside that file (or files) you have implementation class names, which are collected and instantiated.
Re:Java 11 released by hyperman1 on Tuesday September 25, 2018 @03:31PM (#18069698)
Can graalvm do windows too?