How do I change the Java Runtime Environment (JRE) that bliss runs in?

bliss runs inside a Java virtual machine, also known as a Java Runtime Environment (JRE). In most cases bliss ships with its own bundled JRE and this is the JRE that is used by default.

In certain circumstances it might be useful to try using a different JRE. This FAQ lists each supported platform for bliss, with how to change the JRE.

To change the JRE in Windows you need to run bliss from the bliss.bat file.

Run Windows Explorer as an Administrator and navigate to the bliss folder (by default: C:\Program Files\bliss). Then enter the bin folder, which is where the bliss startup scripts are stored.

First, take a copy of bliss.bat and save it as bliss.bat.bak or some other name, as a backup in case things go wrong.

Now, open up your favourite text editor. If you are using Windows Vista or later, you must do this as Administrator, otherwise you will not be able to save changes to the bliss.bat file.

Find %bliss%\bin\bliss.bat and open it inside your text editor. The contents should appear similar to:

@echo off
rem Batch script to run bliss

setlocal
set INSTALL_HOME=%~dp0..

for /d %%a in (
  "%INSTALL_HOME%\jre*"
) do set "JAVA_EXEC=%%~fa\bin\java.exe"

"%JAVA_EXEC%" %VMARGS% -Xmx256M -splash:bliss-splash.png -XX:HeapDumpPath=%TEMP% -XX:+HeapDumpOnOutOfMemoryError -XX:+CMSClassUnloadingEnabled -Djava.util.logging.config.file="%INSTALL_HOME%/conf/logging.properties" -Djava.library.path="%INSTALL_HOME%/lib" -Dbliss.periodicHeapDumpThreshold=0.9 -Dbliss.launcher=%0 -Drun.mode=production -jar -Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2 -Djdk.nio.maxCachedBufferSize=5000000 "%INSTALL_HOME%/lib/com.elsten.bliss.bootstrap.jar"  %*

endlocal
				

Comment out the for statement and add a line assigning JAVA_EXEC to the path to the new JRE's java.exe. The batch script should look similar to:

@echo off
rem Batch script to run bliss

setlocal
set INSTALL_HOME=%~dp0..

rem for /d %%a in (
rem  "%INSTALL_HOME%\jre*"
rem ) do set "JAVA_EXEC=%%~fa\bin\java.exe"
set "JAVA_EXEC=C:\Program files\My Other Jre\bin\java.exe"

"%JAVA_EXEC%" %VMARGS% -Xmx256M -splash:bliss-splash.png -XX:HeapDumpPath=%TEMP% -XX:+HeapDumpOnOutOfMemoryError -XX:+CMSClassUnloadingEnabled -Djava.util.logging.config.file="%INSTALL_HOME%/conf/logging.properties" -Djava.library.path="%INSTALL_HOME%/lib" -Dbliss.periodicHeapDumpThreshold=0.9 -Dbliss.launcher=%0 -Drun.mode=production -jar -Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2 -Djdk.nio.maxCachedBufferSize=5000000 "%INSTALL_HOME%/lib/com.elsten.bliss.bootstrap.jar"  %*

endlocal
				

Note that bliss will still run with the old JRE if run from the EXE (or the shortcut installed by the installer).

Changing the JRE, in Linux, involves setting the $JAVA_HOME environment variable. This can be performed on the command line before launching the bliss shell script:

export JAVA_HOME=/opt/my-jre/
				

This needs to be performed once in each bash session before the script is first launched, although once it is performed it doesn't need to be done again in that session.

To make the change permanent you can add the above line into your ~/.bashrc or equivalent startup file.


Any other FAQs I forgot or clarifications required? Post your ideas below!