quick fix for running on Linux when jar doesn't work

Thoughts, Help, Feature Requests, Bug Reports, Developing code for...

Moderators: dorpond, trevor, Azhrei

Forum rules
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior. :)
Post Reply
woat
Kobold
Posts: 7
Joined: Thu Mar 05, 2020 11:24 pm

quick fix for running on Linux when jar doesn't work

Post by woat »

I want to leave this here for anyone who comes after me having trouble getting MapTools to run on Linux. The jar proved impossible for me to get running no matter what version of java I used even with JavaFX. There is a dirty fix though. Just extract the Maptool folder from the official deb using your favorite archive manager (I used Ark). It includes working binary dependencies for maptools.

The deb structure is maptool.deb/data.tar.xz/opt/MapTool/ . Simply extract that folder and run MapTool. I hope that saves you some time so you don't have to spend hours trying to get the jar to run like I did.

keywords
linux fedora arch ubuntu javafx openjfx

~ash
Kobold
Posts: 2
Joined: Tue Apr 28, 2020 10:36 pm

Re: quick fix for running on Linux when jar doesn't work

Post by ~ash »

Also in the interest of helping anyone who stumbles upon this...

I tried this method of installation, but got a core dump somewhere in the font initialisation process -- the stacktrace ended at sun.font.FontConfigManager.getFontConfig at least. I had various font packages installed, but none of them included Lucida Console, which based on the source code is I think MapTool's default font.

I had to track down the lucida ttf files and install them (copying to ~/.local/share/fonts is one way, more here: https://askubuntu.com/questions/3697/ho ... tall-fonts).

Having the font available on my Linux system made it work. Hope this helps anyone else with the same problem.

woat
Kobold
Posts: 7
Joined: Thu Mar 05, 2020 11:24 pm

Re: quick fix for running on Linux when jar doesn't work

Post by woat »

This method seems to no longer work. Trying to run the new Maptools 1.7.0 on Fedora 32 fails with the error.

[user@localhost MapTool]$ ./MapTool
Error: could not find libjava.so
Error: Could not find Java SE Runtime Environment.

I don't know why as it seems to bundle the same dependencies as before. Maybe it's a Fedora specific bug.

woat
Kobold
Posts: 7
Joined: Thu Mar 05, 2020 11:24 pm

Re: quick fix for running on Linux when jar doesn't work

Post by woat »

~ash wrote:
Tue Apr 28, 2020 10:47 pm
Also in the interest of helping anyone who stumbles upon this...

I tried this method of installation, but got a core dump somewhere in the font initialisation process -- the stacktrace ended at sun.font.FontConfigManager.getFontConfig at least. I had various font packages installed, but none of them included Lucida Console, which based on the source code is I think MapTool's default font.

I had to track down the lucida ttf files and install them (copying to ~/.local/share/fonts is one way, more here: https://askubuntu.com/questions/3697/ho ... tall-fonts).

Having the font available on my Linux system made it work. Hope this helps anyone else with the same problem.
This saved my bacon today. Thank you!

Merudo
Giant
Posts: 228
Joined: Wed Jun 05, 2019 7:06 am

Re: quick fix for running on Linux when jar doesn't work

Post by Merudo »

Thank you for sharing the workaround!

If you could post the full error stack, it could help us figure out what is wrong and fix the issue in a new version.

woat
Kobold
Posts: 7
Joined: Thu Mar 05, 2020 11:24 pm

Re: quick fix for running on Linux when jar doesn't work

Post by woat »

Merudo wrote:
Wed Jun 24, 2020 8:05 pm
Thank you for sharing the workaround!

If you could post the full error stack, it could help us figure out what is wrong and fix the issue in a new version.
I would love to but now I can't reproduce the problem. I even tried a fresh Linux install but it worked this time without copying the fonts to ~/.local/share/fonts. :?:

I guess the good news is people can continue to extract the deb to run Maptool. If it fails to launch they can try copying the fonts from .../MapTool/runtime/lib/fonts to their ~/.local/share/fonts.

woat
Kobold
Posts: 7
Joined: Thu Mar 05, 2020 11:24 pm

Re: quick fix for running on Linux when jar doesn't work

Post by woat »

I just figured out why sometimes I can get Maptools to run from an extracted deb and other times it fails. It's a weird bug.

If I run MapTool from '/home/$USER/Bin/MapTool' it runs but '/home/$USER/bin/MapTool' it fails with this error.
Error: could not find libjava.so
Error: Could not find Java SE Runtime Environment.
I don't know why having a lowercase 'bin' folder breaks it. At least on Manjaro Linux.

taustinoc
Dragon
Posts: 518
Joined: Mon Aug 03, 2015 6:30 pm

Re: quick fix for running on Linux when jar doesn't work

Post by taustinoc »

Linux, like all Unix and BSD derived operating systems, is case sensitive in the file system. In Windows, "B" and "b" are the same, so far as Windows is concerned. But in *nix, they are different characters. What you observe is precisely what I'd expect (assuming the folder is named "Bin" and not "bin").

woat
Kobold
Posts: 7
Joined: Thu Mar 05, 2020 11:24 pm

Re: quick fix for running on Linux when jar doesn't work

Post by woat »

But why does Maptool care if my ~/bin is lowercase or not? I've run a lot of binaries from ~/bin without having this issue before.

edit: Here's the bug in action
https://webm.red/PqZE.webm

~ash
Kobold
Posts: 2
Joined: Tue Apr 28, 2020 10:36 pm

Re: quick fix for running on Linux when jar doesn't work

Post by ~ash »

Merudo wrote:
Wed Jun 24, 2020 8:05 pm
If you could post the full error stack, it could help us figure out what is wrong and fix the issue in a new version.
I'll paste in a stacktrace from the fault below. It's repeatable by just removing one or more of the required Lucida fonts from wherever your fonts are installed. Given that it's so deep in the Swing LAF and native font loader code, I don't know that it's worth fixing though. It will probably only affect people who don't want to use the installer for some reason.

The stack below was generated with the current 1.7 release.

--------------- T H R E A D ---------------

Current thread (0x00007fa7b400f800): JavaThread "main" [_thread_in_native, id=21724, stack(0x00007fa7ba1ba000,0x00007fa7ba9bb000)]

Stack: [0x00007fa7ba1ba000,0x00007fa7ba9bb000], sp=0x00007fa7ba9b45d8, free space=8169k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [libfontconfig.so.1+0x19c19]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j sun.font.FontConfigManager.getFontConfig(Ljava/lang/String;Lsun/font/FontConfigManager$FontConfigInfo;[Lsun/font/FontConfigManager$FcCompFont;Z)V+0 [email protected]
j sun.font.FontConfigManager.initFontConfigFonts(Z)V+178 [email protected]
j sun.font.FontConfigManager.loadFontConfig()[Lsun/font/FontConfigManager$FcCompFont;+2 [email protected]
j sun.font.FcFontConfiguration.init()Z+39 [email protected]
j sun.font.FcFontConfiguration.<init>(Lsun/font/SunFontManager;)V+16 [email protected]
j sun.awt.X11FontManager.createFontConfiguration()Lsun/awt/FontConfiguration;+40 [email protected]
j sun.font.SunFontManager$2.run()Ljava/lang/Object;+176 [email protected]
v ~StubRoutines::call_stub
J 970 java.security.AccessController.doPrivileged(Ljava/security/PrivilegedAction;)Ljava/lang/Object; [email protected] (0 bytes) @ 0x00007fa7a615318f [0x00007fa7a6153140+0x000000000000004f]
j sun.font.SunFontManager.<init>()V+222 [email protected]
j sun.awt.FcFontManager.<init>()V+1 [email protected]
j sun.awt.X11FontManager.<init>()V+1 [email protected]
v ~StubRoutines::call_stub
J 1220 jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Ljava/lang/reflect/Constructor;[Ljava/lang/Object;)Ljava/lang/Object; [email protected] (0 bytes) @ 0x00007fa7a6170c23 [0x00007fa7a6170bc0+0x0000000000000063]
J 1218 c1 jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance([Ljava/lang/Object;)Ljava/lang/Object; [email protected] (89 bytes) @ 0x00007fa79edd26dc [0x00007fa79edd1b40+0x0000000000000b9c]
J 1250 c1 jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance([Ljava/lang/Object;)Ljava/lang/Object; [email protected] (9 bytes) @ 0x00007fa79eddbcdc [0x00007fa79eddbbe0+0x00000000000000fc]
J 1248 c1 java.lang.reflect.Constructor.newInstance([Ljava/lang/Object;)Ljava/lang/Object; [email protected] (76 bytes) @ 0x00007fa79eddb604 [0x00007fa79eddb3a0+0x0000000000000264]
j sun.font.FontManagerFactory$1.run()Ljava/lang/Object;+32 [email protected]
v ~StubRoutines::call_stub
J 970 java.security.AccessController.doPrivileged(Ljava/security/PrivilegedAction;)Ljava/lang/Object; [email protected] (0 bytes) @ 0x00007fa7a615318f [0x00007fa7a6153140+0x000000000000004f]
j sun.font.FontManagerFactory.getInstance()Lsun/font/FontManager;+17 [email protected]
j java.awt.Font.getFont2D()Lsun/font/Font2D;+0 [email protected]
j java.awt.Font.getFamily(Ljava/util/Locale;)Ljava/lang/String;+15 [email protected]
j java.awt.Font.getFamily_NoClientCode()Ljava/lang/String;+4 [email protected]
j java.awt.Font.getFamily()Ljava/lang/String;+1 [email protected]
j sun.swing.SwingUtilities2.displayPropertiesToCSS(Ljava/awt/Font;Ljava/awt/Color;)Ljava/lang/String;+23 [email protected]
j javax.swing.plaf.basic.BasicHTML$BasicDocument.setFontAndColor(Ljava/awt/Font;Ljava/awt/Color;)V+6 [email protected]
j javax.swing.plaf.basic.BasicHTML$BasicDocument.<init>(Ljavax/swing/text/html/StyleSheet;Ljava/awt/Font;Ljava/awt/Color;)V+13 [email protected]
j javax.swing.plaf.basic.BasicHTML$BasicEditorKit.createDefaultDocument(Ljava/awt/Font;Ljava/awt/Color;)Ljavax/swing/text/Document;+28 [email protected]
j javax.swing.plaf.basic.BasicHTML.createHTMLView(Ljavax/swing/JComponent;Ljava/lang/String;)Ljavax/swing/text/View;+13 [email protected]
j javax.swing.plaf.basic.BasicHTML.updateRenderer(Ljavax/swing/JComponent;Ljava/lang/String;)V+40 [email protected]
j javax.swing.plaf.basic.BasicLabelUI.installComponents(Ljavax/swing/JLabel;)V+5 [email protected]
j javax.swing.plaf.basic.BasicLabelUI.installUI(Ljavax/swing/JComponent;)V+13 [email protected]
j javax.swing.JComponent.setUI(Ljavax/swing/plaf/ComponentUI;)V+52 [email protected]
j javax.swing.JLabel.setUI(Ljavax/swing/plaf/LabelUI;)V+2 [email protected]
j javax.swing.JLabel.updateUI()V+8 [email protected]
j javax.swing.JLabel.<init>(Ljava/lang/String;Ljavax/swing/Icon;I)V+83 [email protected]
j javax.swing.JLabel.<init>(Ljava/lang/String;I)V+4 [email protected]
j javax.swing.plaf.basic.BasicOptionPaneUI.addMessageComponents(Ljava/awt/Container;Ljava/awt/GridBagConstraints;Ljava/lang/Object;IZ)V+409 [email protected]
j javax.swing.plaf.basic.BasicOptionPaneUI.createMessageArea()Ljava/awt/Container;+220 [email protected]
j javax.swing.plaf.basic.BasicOptionPaneUI.installComponents()V+5 [email protected]
j javax.swing.plaf.basic.BasicOptionPaneUI.installUI(Ljavax/swing/JComponent;)V+24 [email protected]
j javax.swing.JComponent.setUI(Ljavax/swing/plaf/ComponentUI;)V+52 [email protected]
j javax.swing.JOptionPane.setUI(Ljavax/swing/plaf/OptionPaneUI;)V+10 [email protected]
j javax.swing.JOptionPane.updateUI()V+8 [email protected]
j javax.swing.JOptionPane.<init>(Ljava/lang/Object;IILjavax/swing/Icon;[Ljava/lang/Object;Ljava/lang/Object;)V+67 [email protected]
j javax.swing.JOptionPane.<init>(Ljava/lang/Object;IILjavax/swing/Icon;[Ljava/lang/Object;)V+9 [email protected]
j javax.swing.JOptionPane.<init>(Ljava/lang/Object;IILjavax/swing/Icon;)V+7 [email protected]
j javax.swing.JOptionPane.<init>(Ljava/lang/Object;II)V+5 [email protected]
j com.jidesoft.dialog.JideOptionPane.<init>(Ljava/lang/Object;II)V+4
j net.rptools.maptool.client.swing.MapToolEventQueue.<clinit>()V+19
v ~StubRoutines::call_stub
j net.rptools.maptool.client.MapTool.main([Ljava/lang/String;)V+1093
j net.rptools.maptool.client.LaunchInstructions.main([Ljava/lang/String;)V+62
v ~StubRoutines::call_stub

chinrpg
Kobold
Posts: 1
Joined: Sat Aug 22, 2020 8:23 am

If MapTool won't start, copy fonts to the following directory

Post by chinrpg »

woat wrote:
Sat Jun 27, 2020 3:01 pm
If it fails to launch they can try copying the fonts from .../MapTool/runtime/lib/fonts to their ~/.local/share/fonts.
This part was buried in the forum thread, so I just wanted to emphasize it:
If MapTool fails to launch, try copying the fonts from .../MapTool/runtime/lib/fonts to your ~/.local/share/fonts directory

That is what saved me.
In my particular case, running Kubuntu 18.04, I copied the files from /opt/MapTool/runtime/lib/fonts/ to /home/<my username>/.local/share/fonts/
There were 9 files I copied, of which 8 were named "Lucida<something>.ttf" and one was "fonts.dir".

Hopefully this helps people who download MapTool and it completely refuses to run with only a cryptic error message. Shouldn't it say something like "font files not found within <directory name> or something more useful like that?

Thank you, woat!

Post Reply

Return to “MapTool”