The code below does its job, but leaves a copy of the font file in the temp directory every time it starts. These files are called + ~ JF7154903081130224445.tmp, where the number seems random for each file created.
InputStream fontStream = this.getClass().getResourceAsStream("handsean.ttf"); Font baseFont = Font.createFont(Font.TRUETYPE_FONT, fontStream); fontStream.close();
I found many years of discussion on forums on sun.com and other resources on the Internet where it is recognized as a bug in the JDK, where updating from 1.5.0_06 to 1.5.0_08 will solve the problem; however, the version I'm using is a later version (1.6.0_13).
I tried to solve the problem by deleting the files after completing the operations related to the font, but the files were locked at this time. Files can only be deleted after the web application is stopped.
Does anyone have a solution?
java fonts graphics2d temporary-files
user213254
source share