Bug 2368701

Summary: msgfmt: Java compiler not found, try installing gcj or set $JAVAC
Product: [Fedora] Fedora Reporter: Tim Greller <mail>
Component: gettextAssignee: Manish Tiwari <matiwari>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: rawhideCC: dueno, i18n-bugs, matiwari, nphilipp, petersen, sundeep_anand
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-05-28 12:56:00 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tim Greller 2025-05-27 08:24:40 UTC
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

Comment 1 Manish Tiwari 2025-05-28 10:14:03 UTC
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

Comment 2 Tim Greller 2025-05-28 12:56:00 UTC
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 ***