When I execute msgfmt with --java2, I get the following error: msgfmt: Java compiler not found, try installing gcj or set $JAVAC msgfmt: compilation of Java class failed, please try --verbose or set $JAVAC --verbose only shows the additional line with x translated messages, ... msgfmt (v0.21) is installed by installing the latest version of gettext. I also built and installed what seems to be a newer version from https://answers.launchpad.net/ubuntu/+source/gettext/0.23.1-2, but it doesn't seem to include msgfmt? If I run javac -version, I get: javac 17.0.7 And for java -version, I get: openjdk version "17.0.7" 2023-04-18 OpenJDK Runtime Environment (build 17.0.7+7-Debian-1deb11u1) OpenJDK 64-Bit Server VM (build 17.0.7+7-Debian-1deb11u1, mixed mode, sharing) As suggested in the error message, I tried setting $JAVAC. It's now set to /usr/lib/jvm/java-17-openjdk-amd64/bin but I still get the same error. Reproducible: Always Steps to Reproduce: 1. Create a de.po file (e.g. using xgettext and poedit) 2. Run msgfmt --java2 -d src/conf -r app.i18n.Messages -l de po/de.po Actual Results: msgfmt: Java compiler not found, try installing gcj or set $JAVAC msgfmt: compilation of Java class failed, please try --verbose or set $JAVAC Expected Results: No error, but a ResourceBundle class
Hi Tim, Setting up JAVAC to the full path of javac binary (not the directory) worked for me : export JAVAC=/usr/lib/jvm/java-21-openjdk/bin/javac
Hi Manish, thanks for your reply! JAVAC doesn't seem to matter, though. I tried it again with JAVAC set to both values and not set to anything at all, and all three of them worked. All I needed to do to fix it was reboot my system. Now, the 0.23 version I tried to install last time from https://answers.launchpad.net/ubuntu/+source/gettext/0.23.1-2 works. So the bug I was experiencing was the same as https://bugzilla.redhat.com/show_bug.cgi?id=2062407. It's just hard to get the latest version of the tool imo. *** This bug has been marked as a duplicate of bug 2062407 ***