Mark Stephens Mark Stephens has been working with Java and PDF since 1999 and has diversified into HTML5, SVG and JavaFX. He also enjoys speaking at conferences and has been a Speaker at user groups, Business of Software, Seybold and JavaOne conferences. He has a very dry sense of humor and an MA in Medieval History for which he has not yet found a practical use.

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 Mark Stephens has been working with Java and PDF since 1999 and has diversified into HTML5, SVG and JavaFX. He also enjoys speaking at conferences and has been a Speaker at user groups, Business of Software, Seybold and JavaOne conferences. He has a very dry sense of humor and an MA in Medieval History for which he has not yet found a practical use.

Leave a Reply

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

© IDRsolutions Ltd 2019. All rights reserved.