Java Custom JRE Support (Extensions)

Rob Barry rob+libreoffice at muishkin.co.uk
Mon Sep 16 12:34:43 UTC 2019


On Mon, 2019-09-16 at 14:22 +0200, Stephan Bergmann wrote:
> On 16/09/2019 13:42, Rob Barry wrote:
> > I've been developing an extension for LibreOffice in Java and have defaulted to targeting the
> > v1.8
> > JDK.
> > 
> > One issue I've noticed with this is that LibreOffice on Windows requires the x64 JRE in order to
> > execute the extension. Given this is not the standard/suggested JRE download for windows it adds
> > a
> > bit of complication when a user attempts to install the extension.
> 
> Not sure what "the standard/suggested JRE download for windows" would 
> be.  But note that LO runs the JVM in-process in its own soffice.bin 
> process, so for a 32-bit LO installation the user needs to obtain a 
> 32-bit JRE, while for a 64-bit LO installation they need to obtain a 
> 64-bit JRE.
> 

Essentially, the preferred download option on Windows seems to be the x86 JRE rather than the x64
one, even when the user is running an x64 version of Windows. This may conflict with the default
download for libreoffice. Essentially, this may confuse non-technical users. But this issue is just a
side-note really.

See the following for an example of the confusion in the wild: 
https://ask.libreoffice.org/en/question/141067/why-does-libre-office-suddenly-not-recognize-java/

> > One way I thought this could be fixed is to use the jlink (
> > https://docs.oracle.com/en/java/javase/11/tools/jlink.html
> >  +
> > https://blog.idrsolutions.com/2017/05/java-9-jlink-explained-in-5-minutes/
> > ) functionality which the
> > JDK v9 ships with. Broadly speaking this allows the developer to create a custom JRE for the
> > application which contains a sub-set of the modules contained in the standard JRE (so it's more
> > performant + uses less memory). I've also read suggestions that Java development will be moving
> > further in this direction with standard JREs not shipped by Oracle at all.
> > 
> > "Developers who deploy desktop applications to individual consumers (eg, games, personal banking,
> > or
> > other B2C applications) will need to transition to other deployment technologies such as the
> > jlink
> > and/or third party packaging and deployment solutions before the end of 2020." -
> > https://www.oracle.com/technetwork/java/javase/javaclientroadmapupdate2018mar-4414431.pdf
> > 
> > 
> > This leads to my question: does LibreOffice have any support for the use of jlink custom-built
> > JREs
> > to build extensions?  Alternatively, are there any plans to support this in future?
> 
> There are no such plans by anyone I'm aware of at least.  As above, LO 
> uses a single in-process JVM for all of its Java needs (from extensions 
> and from whatever core components that use Java).
> 

If extensions and everything else use the built-in JVM, why is there a JRE selection dialog in the
settings and why are users prompted to install a JRE when installing Java extensions? See 
https://libreofficehelp.com/how-to-fix-libreoffice-requires-a-java-runtime-environment-error/

> 



More information about the LibreOffice mailing list