Install moneydance

I’m trying to install moneydance (2021) which has a linux install script but I’m not able to get it to work. I’ve installed jdk17 like this in my /etc/nixos/configuration.nix

programs.java = { enable = true; package = pkgs.openjdk17; };

…but when I run the install script sh Downloads/moneydance_linux_amd64.sh I get:

Unpacking JRE …
Starting Installer …
Downloads/moneydance_linux_amd64.sh: line 528: /home/john/Downloads/moneydance_linux_amd64.sh.46358.dir/jre/bin/java: cannot execute: required file not found

I’m thinking the installer is not made for running with nixos. I can provide the output from:
sh -x Downloads/moneydance_linux_amd64.sh
if that may help.

Also looking at using a nix-shell and buildFHSEnv:

{ pkgs ? import <nixpkgs> {} }:

(pkgs.buildFHSEnv {
  name = "simple-x11-env";
  targetPkgs = pkgs: (with pkgs; [
    openjdk17
    libz
  ]);
}).env

but I’m stuck here too, with this error:

Unpacking JRE ...
Starting Installer ...
java.lang.NoClassDefFoundError: Could not initialize class java.awt.Component
        at java.desktop/javax.swing.ImageIcon$2.run(Unknown Source)
        at java.desktop/javax.swing.ImageIcon$2.run(Unknown Source)
        at java.base/java.security.AccessController.doPrivileged(Unknown Source)
        at java.desktop/javax.swing.ImageIcon.createNoPermsComponent(Unknown Source)
        at java.desktop/javax.swing.ImageIcon$1.run(Unknown Source)
        at java.desktop/javax.swing.ImageIcon$1.run(Unknown Source)
        at java.base/java.security.AccessController.doPrivileged(Unknown Source)
        at java.desktop/javax.swing.ImageIcon.<clinit>(Unknown Source)
        at com.install4j.runtime.installer.frontend.GUIHelper.loadIcon(GUIHelper.java:192)
        at com.install4j.runtime.installer.frontend.GUIHelper.<clinit>(GUIHelper.java:50)
        at com.install4j.runtime.installer.frontend.headless.AbstractHeadlessScreenExecutor.init(AbstractHeadlessScreenExecutor.java:73)
        at com.install4j.runtime.installer.frontend.headless.ConsoleScreenExecutor.<init>(ConsoleScreenExecutor.java:24)
        at com.install4j.runtime.installer.frontend.headless.InstallerConsoleScreenExecutor.<init>(InstallerConsoleScreenExecutor.java:6)
        at com.install4j.runtime.installer.Installer.getScreenExecutor(Installer.java:87)
        at com.install4j.runtime.installer.Installer.runInProcess(Installer.java:56)
        at com.install4j.runtime.installer.Installer.main(Installer.java:45)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:85)
        at com.install4j.runtime.launcher.UnixLauncher.main(UnixLauncher.java:62)
An error occurred:
java.lang.NoClassDefFoundError: Could not initialize class java.awt.Toolkit
Error log: /tmp/install4jError13861951974109939667.log
java.lang.NoClassDefFoundError: Could not initialize class java.awt.Toolkit
        at java.desktop/javax.swing.ImageIcon.<init>(Unknown Source)
        at java.desktop/javax.swing.ImageIcon.<init>(Unknown Source)
        at com.install4j.runtime.installer.frontend.GUIHelper.loadIcon(GUIHelper.java:192)
        at com.install4j.runtime.installer.frontend.GUIHelper.<clinit>(GUIHelper.java:50)
        at com.install4j.runtime.installer.frontend.headless.AbstractHeadlessScreenExecutor.init(AbstractHeadlessScreenExecutor.java:73)
        at com.install4j.runtime.installer.frontend.headless.ConsoleScreenExecutor.<init>(ConsoleScreenExecutor.java:24)
        at com.install4j.runtime.installer.frontend.headless.InstallerConsoleScreenExecutor.<init>(InstallerConsoleScreenExecutor.java:6)
        at com.install4j.runtime.installer.Installer.getScreenExecutor(Installer.java:87)
        at com.install4j.runtime.installer.Installer.runInProcess(Installer.java:56)
        at com.install4j.runtime.installer.Installer.main(Installer.java:45)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:85)
        at com.install4j.runtime.launcher.UnixLauncher.main(UnixLauncher.java:62)

Some progress with modifying my shell.nix like this:

{ pkgs ? import <nixpkgs> {} }:

(pkgs.buildFHSEnv {
  name = "simple-x11-env";
  targetPkgs = pkgs: (with pkgs; [
    udev
    openjdk17
    #jre17_minimal
    zlib
    ncurses
    libxslt
    alsa-lib
  ]) ++ (with pkgs.xorg; [
    libX11
    libXcursor
    libXrandr
    libXtst
    libXext
    libXi
    libXt
    libXpm
    libXmu
    libXp
    libxcb
    libXScrnSaver
    libXxf86vm
    libXcomposite
    libXdamage
    libXfixes
    libXrender
  ]);
  multiPkgs = pkgs: (with pkgs; [
    udev
    alsa-lib
  ]);
  runScript = "bash";
}).env

and then within here I could run sh Downloads/moneydance_linux_amd64.sh -c which ran the installer.

But now I don’t see how I can run the program :confused: When I go back into this nix-shell and try to run the program nothing happens.

You’d be better off writing a Nix package using the .dep file rather than the interactive install script. Here are a couple of Nix packages for Java applications, which can serve as examples:

Thanks for this info! looking at those examples it kind of looks like I’d be making a new install script… which at the moment is a bit beyond me.

The buildFHSEnv looks like a viable option but I think it’s not capable of accessing the x server. When running the moneydance install script I got a message…

Could not display the GUI. This application needs access to an X Server.


You can also run this application in console mode without
access to an X server by passing the argument -c


…so I forced the install with the -c flag. So I think this might be preventing me from seeing anything when I try launching the app.

It seems like other scenarios (like games) would need the x sever too. I’ll do some more digging.

The actual error will likely be inside this log file.

Found a lot of info here in this amazing Answer which allowed me to get the buildFHSEnv method to work. I did not try all of what’s mentioned there but noticed there were comments on “without these it silently fails” so I started adding in packages to my shell.nix until I could run the moneydance installer with the GUI.

Here’s my final shell.nix that also launches the app when called:

{ pkgs ? import <nixpkgs> {} }:

(pkgs.buildFHSEnv {
  name = "simple-x11-env";
  targetPkgs = pkgs: (with pkgs; [
    udev
    #openjdk17
    jre17_minimal
    zlib
    ncurses
    libelf
    libxslt
    alsa-lib
    xdg-utils
    libGL
    openssl
    libva
    glib
    gtk2
    bzip2
  ]) ++ (with pkgs.xorg; [
    libX11
    libXcursor
    libXrandr
    libXtst
    libXext
    libXi
    libXt
    libXpm
    libXmu
    libXp
    libxcb
    libXScrnSaver
    libXxf86vm
    libXcomposite
    libXdamage
    libXfixes
    libXrender
    libxshmfence
    libXinerama
    libSM
    libICE
  ]);
  multiPkgs = pkgs: (with pkgs; [
    udev
    alsa-lib
  ]);
  #note installer installed into ~/moneydance
  runScript = "sh ~/moneydance/Moneydance";
}).env

Not sure which package it was (maybe all) as I was slightly inpatient and adding in chunks and not removing, but probably a combo of these: libGL, openssl, libva, glib, gtk2, bzip2.

That answer mentioned multiple options and I would probably try either steam-run or distrobox next if I was unsuccessful with this attempt.

As a side note, I did get moneydance to work in a docker container but this seems like a last resort type of solution.

1 Like