Page 1 of 1

[SOLVED] launch a java program with Java 8 on Mageia 8?

PostPosted: Apr 16th, '21, 14:23
by morgano
After I upgraded from Mageia7 to Mageia 8, the old java based invoicing program I use fail print preview and printing.
(Reported bug here, with terminal output.)

I see in terminal output, it use Java version 11.0.10-ea

I have both java-1.8.0-openjdk (java 8) and java-11-openjdk installed.

How do I force it to use java 8 ?

My current launch command:
Code: Select all
cd "/home/morgan/Tribun/Eko/FriBok" ; _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on" java -jar *.jar


Uninstalling java 11 is not an option as much depend on that version.

Re: How to launch a java program with Java 8 on Mageia 8?

PostPosted: Apr 16th, '21, 16:44
by doktor5000
Use alternatives to switch the default java version to java 8. Try as root with
Code: Select all
alternatives --config java

Re: How to launch a java program with Java 8 on Mageia 8?

PostPosted: Apr 16th, '21, 19:59
by morgano
That worked great, thanks :)

I can live with that, but if there is a way to set it only for a -jar file at launch it would be perfect.

Re: [SOLVED] launch a java program with Java 8 on Mageia 8?

PostPosted: Apr 16th, '21, 20:46
by doktor5000
Well you can run it manually with the java binary with full path but you may want to manually set/export things like JAVA_LIBDIR or JAVA_HOME
You can have a look at the paths using
Code: Select all
alternatives --display java
and also have a look at /etc/java/java.conf

Re: [SOLVED] launch a java program with Java 8 on Mageia 8?

PostPosted: Apr 17th, '21, 10:06
by morgano
Many thanks.
Now I could set system default back to java 11

Only remedy I had to do was in my start link just replace java with /usr/lib/jvm/java-1.8.0-openjdk-1.8.0*/jre/bin/java
(using the * to make it work after future java8 updates)