javaswingfontsprivileged-functions

Java Font.createFont fails on Linux because of sun.misc.IOUtils.createTempFile("+~JF", ".tmp", null)


I've some code that ultimately calls Font.createFont. It works fine on server (centos something...) but on my Ubuntu box it dies because of this call that is inside Font.createFont

final File tFile = AccessController.doPrivileged(
                new PrivilegedExceptionAction<File>() {
                    public File run() throws IOException {
                        return sun.misc.IOUtils.createTempFile("+~JF", ".tmp", null);
                    }
                }
            );

My /tmp dir is readable/writable by the entire world. No idea why this is happening.


Solution

  • This was simply failing because my tomcat installation didn't have a temp directory. Creating the directory just solved the problem. :)