- Newest
- Most votes
- Most comments
The issue you're experiencing with Jasper Reports on your AWS EC2 instance is related to font configuration. This is a common problem when running Java applications that rely on system fonts in a Linux environment.
To resolve this issue, you need to ensure that the necessary fonts are installed and properly configured on your EC2 instance. Here are some steps you can try:
-
Install the required fonts: Run the following command to install a set of common fonts: sudo apt-get install fonts-liberation
-
Update the font cache: After installing the fonts, update the font cache by running: sudo fc-cache -f -v
-
Install additional font packages: You may need to install more font packages, such as: sudo apt-get install fontconfig sudo apt-get install msttcorefonts
-
Verify font configuration: Check if the fonts are properly recognized by running: fc-list
-
Restart your Java application or the entire EC2 instance to ensure the changes take effect.
If the problem persists, you may need to specify the font directory explicitly in your Java application. You can do this by adding the following system property when starting your Java application:
-Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.library.path=/usr/share/fonts/truetype
Make sure to adjust the path if your fonts are located in a different directory.
If you're still encountering issues after trying these steps, you may need to investigate further by checking your application's font configuration files and ensuring they are correctly set up for your EC2 environment.
Sources
Access AWS EC2 Instance ubuntu by ssh losted. | AWS re:Post
The issue with Jasper Reports on your AWS EC2 instance arises from missing or improperly configured fonts, which is common when Java applications rely on system fonts in Linux environments.
I did all that you send me but problem still the same. Result of fc-cache -f -v:
sudo fc-cache -f -v
Font directories:
/root/.local/share/fonts
/usr/local/share/fonts
/usr/share/fonts
/root/.fonts
/usr/share/fonts/X11
/usr/share/fonts/truetype
/usr/share/fonts/X11/encodings
/usr/share/fonts/X11/util
/usr/share/fonts/truetype/dejavu
/usr/share/fonts/truetype/liberation
/usr/share/fonts/truetype/msttcorefonts
/usr/share/fonts/X11/encodings/large
/root/.local/share/fonts: skipping, no such directory
/usr/local/share/fonts: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts: caching, new cache contents: 0 fonts, 2 dirs
/usr/share/fonts/X11: caching, new cache contents: 0 fonts, 2 dirs
/usr/share/fonts/X11/encodings: caching, new cache contents: 0 fonts, 1 dirs
/usr/share/fonts/X11/encodings/large: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/X11/util: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/truetype: caching, new cache contents: 0 fonts, 3 dirs
/usr/share/fonts/truetype/dejavu: caching, new cache contents: 6 fonts, 0 dirs
/usr/share/fonts/truetype/liberation: caching, new cache contents: 16 fonts, 0 dirs
/usr/share/fonts/truetype/msttcorefonts: caching, new cache contents: 60 fonts, 0 dirs
/root/.fonts: skipping, no such directory
/usr/share/fonts/X11: skipping, looped directory detected
/usr/share/fonts/truetype: skipping, looped directory detected
/usr/share/fonts/X11/encodings: skipping, looped directory detected
/usr/share/fonts/X11/util: skipping, looped directory detected
/usr/share/fonts/truetype/dejavu: skipping, looped directory detected
/usr/share/fonts/truetype/liberation: skipping, looped directory detected
/usr/share/fonts/truetype/msttcorefonts: skipping, looped directory detected
/usr/share/fonts/X11/encodings/large: skipping, looped directory detected
/var/cache/fontconfig: cleaning cache directory
/root/.cache/fontconfig: not cleaning non-existent cache directory
/root/.fontconfig: not cleaning non-existent cache directory
fc-cache: succeeded
My application:
System.getProperty("-Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.library.path=/usr/share/fonts/truetype");
answered 2 years ago
Relevant content
asked 2 years ago
asked 4 years ago
asked 2 years ago
asked 6 years ago
