How to use your own font directory to drastically reduce start-up times Not many things in this world are more frustrating than a slow development environment. Most programmers have little patience for creeping compiles or sluggish start-ups — and I count myself among them.I was dismayed when several simple Java 2D applications I was developing for my new Media Programming column took not seconds but several minutes to start up and paint a simple Frame. My search for an explanation and workaround in the JDK documentation on the Sun product page (see Resources) and in the JDK 1.2 Beta 3 README was in vain.After that, and several unproductive e-mails to friends and associates, I made a startling discovery: There is a known performance problem in the JDK 1.2 Beta 3 for Windows involving fonts. This problem has a relatively easy workaround, but neither problem nor solution are mentioned anywhere on the main JDK 1.2 product page. Why things are slow, or the story of a JDK that loads too many fontsMy salvation came in the form of a post to the Java Developer Connection (see Resources for the URL of this post). The post explained that JDK 1.2 Beta 3 is in fact many times slower (potentially hundreds of times slower) at start-up than the previous 1.2 Beta 2. JDK 1.2 Beta 3 for Windows NT/95 attempts to load every font in the Windows font directory (on my Windows 95 system, this is C:WindowsFonts) before starting your actual Java application. This in spite of the fact that most applications don’t need anything but the default fonts and make no special use of Java font support. This is a nasty bug, and if you need to use 1.2 Beta 3, it’s one you’ll definitely want to work around.How do I fix this?The JDK 1.2 Beta 3 workaround is relatively simple. First, you should copy the four required True Type fonts (Arial.ttf, Cour.ttf, Times.ttf, and Wingding.ttf) from your Windows font directory into a new directory of your choice. I chose to create a directory under my JDK 1.2 Beta 3 installation: C:jdk1.2beta3Fonts Note that it’s important that you copy the fonts rather than simply moving them. This is so that your other, well-behaved Windows applications can still use these fonts. Next, you need to instruct your Java tools and runtime to use the new font directory instead of the system default. You do this by setting the JAVA_FONTS environment variable in your autoexec.bat to point to your new fonts directory. For example, for my installation, I set this as: SET JAVA_FONTS=C:jdk1.2beta3Fonts Now, execute your autoexec.bat and you should see your Java apps start up with amazing speed, relative to JDK 1.2 Beta 3 without this workaround. The more fonts you have in your Windows font directory, the greater the difference in speed.Try a before and after comparison. I promise you’ll be amazed that this bug slipped by Sun’s test-and-release engineering team! Happy hackingWaiting a long time for a program to start up is a frustrating experience. This tip helps remove the slow start-up time — a major and unnecessary barrier to your use of the JDK beta release. Let’s all hope Sun fixes this bug in Beta 4.Bill Day is a software engineer at Silicon Graphics Computer Systems. Bill writes the JavaWorld Media Programming column and is also authoring a book entitled Java Media Players for O’Reilly & Associates. When Bill is not writing or programming, he loves to travel with his wife, speak French, and enjoy life. Java, c’est magnifique!