J’ava deployed to tomcat, and found a problem. The verification code of our login appeared garbled code, and characters
However, on the windows server, or our local development environment, there is no such phenomenon
Why
Looking at the source code, we found a piece of code:
new Font(“Times New Roman”, 0, 18)
The original windows operating system has its own default font, namely Times New Roman
Our Linux system, taking CentOS 7.3 as an example, does not have this font. After all, our Linux system does not have a graphical operation interface, so it does not have its own default font
Therefore, we need to install the font on the Linux system. The process is as follows:
1. First, open our terminal. The default path of font is: usr/share/fonts
CD in
2. Create a new path (folder), MKDIR “Times New Roman”
Why double quotes?Because we need to develop a good habit, if there are no double quotation marks, we will create three new folders, that is, three paths time New Roman. We can’t create paths with spaces
3. Then upload all times New Roman Fonts in fonts folder of our local windows folder to this path. Take the local win7 system as an example, after uploading, we need to execute three commands in this path in turn, as follows:
mkfontscale
mkfontdir
fc-cache -fv
There is a problem. Our CentOS system does not have these commands by default. At this time, we need to install the following commands online. The commands are as follows:
yum install mkfontscale
After installation, confirm in turn
4. Restart our Tomcat
cd ../bin/; sh startup.sh; cd ../logs/; tail -f catalina.out
Just press enter
Note that all the above operations on fonts must be completed under the root permission
5. After the restart, refresh our verification code again. As expected, it changed from random characters back to our letters and numbers
Similar Posts:
- Roman to Integer LeetCode Java
- Oserror: cannot open resource (pilot error handling)
- Ultra character map for Mac
- How to Install Consolas Font in MacOS
- Download and installation of iconfont in sketch and abnormal display of Icon
- Captcha reports an error java.lang.arrayindexoutofboundsexception
- error: no video mode activated. [How to Solve]
- NETCORE uses freespire.doc to add pictures to word on Linux. The error is: system.dllnotfoundexception: unable to load shared library ‘libgdiplus’ or one of its dependencies
- [Solved] ElasticSearch Error: FORBIDDEN/12/index read-only/allow delete (api) ,read_only_allow_delete Set windows
- [How to]docker http: server gave HTTP response to HTTPS client