Bug 2368701 - msgfmt: Java compiler not found, try installing gcj or set $JAVAC
Summary: msgfmt: Java compiler not found, try installing gcj or set $JAVAC
Keywords:
Status: CLOSED DUPLICATE of bug 2062407
Alias: None
Product: Fedora
Classification: Fedora
Component: gettext
Version: rawhide
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Manish Tiwari
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2025-05-27 08:24 UTC by Tim Greller
Modified: 2025-05-28 12:56 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2025-05-28 12:56:00 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

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 ***


Note You need to log in before you can comment on or make changes to this bug.