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

This forum is dedicated to basic help and support :

Ask here your questions about basic installation and usage of Mageia. For example you may post here all your questions about getting Mageia isos and installing it, configuring your printer, using your word processor etc.

Try to ask your questions in the right sub-forum with as much details as you can gather. the more precise the question will be, the more likely you are to get a useful answer

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

Postby morgano » Apr 16th, '21, 14:23

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.
Last edited by morgano on Apr 16th, '21, 20:00, edited 1 time in total.
Mandriva since 2006, Mageia 2011 at home & work. Thinkpad T40, T43, T400, T510, Dell M4400, M6300, Acer Aspire 7. Workstation using LVM, LUKS, VirtualBox, BOINC
morgano
 
Posts: 1306
Joined: Jun 15th, '11, 17:51
Location: Kivik, Sweden

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

Postby doktor5000 » Apr 16th, '21, 16:44

Use alternatives to switch the default java version to java 8. Try as root with
Code: Select all
alternatives --config java
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17629
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

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

Postby morgano » Apr 16th, '21, 19:59

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.
Mandriva since 2006, Mageia 2011 at home & work. Thinkpad T40, T43, T400, T510, Dell M4400, M6300, Acer Aspire 7. Workstation using LVM, LUKS, VirtualBox, BOINC
morgano
 
Posts: 1306
Joined: Jun 15th, '11, 17:51
Location: Kivik, Sweden

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

Postby doktor5000 » Apr 16th, '21, 20:46

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
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17629
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

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

Postby morgano » Apr 17th, '21, 10:06

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)
Mandriva since 2006, Mageia 2011 at home & work. Thinkpad T40, T43, T400, T510, Dell M4400, M6300, Acer Aspire 7. Workstation using LVM, LUKS, VirtualBox, BOINC
morgano
 
Posts: 1306
Joined: Jun 15th, '11, 17:51
Location: Kivik, Sweden


Return to Basic support

Who is online

Users browsing this forum: No registered users and 1 guest

cron