Mark Stephens I have been working with Java and PDF since 1999 and am a big NetBeans fan. I enjoy speaking at conferences. I have an MA in Medieval History and a passion for reading.

Interesting change in File handling between Java 6 and Java 7

31 sec read

One of the things we do in our PDF library is to scan the Font directories (ie C:/win and /Library/fonts) for any TrueType or OpenType fonts to use in our PDF viewer. On the Mac, this contains some ‘interesting’ files.

When we switched over to Java 7, they started to show this error in our code….

java.io.FileNotFoundException: /Library/Fonts/������������������������ ProN W4.otf (No such file or directory)

at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:97)

We can easily trap this by checking the file exists first with

new File(fontPath + currentFont).exists()

but it is a definite change in the way the File function works. Have you found any similar ‘changes’?

This post is part of our “Fonts Articles Index” in these articles we explore Fonts.

IDRsolutions develop a Java PDF Viewer and SDK, an Adobe forms to HTML5 forms converter, a PDF to HTML5 converter and a Java ImageIO replacement. On the blog our team post anything interesting they learn about.

Mark Stephens I have been working with Java and PDF since 1999 and am a big NetBeans fan. I enjoy speaking at conferences. I have an MA in Medieval History and a passion for reading.

Leave a Reply

Your email address will not be published. Required fields are marked *

IDRsolutions Ltd 2019. All rights reserved.