Ant FAQ: How to determine the platform operating system in an Ant build script


You're creating an Ant build script, and you need to determine the operating system the script is running on, so you can make conditional decisions within the build script. You typically want/need to do this if you're going to run tasks/targets that are different for each operating system (Mac, Windows, Unix, etc.).

Java: How to list of all the available Java/Swing fonts

Java Fonts FAQ: How do I create a list of all the fonts available on the current platform?

Answer: To list all the fonts available to you in a Java application (a Java Swing application), I use the GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames() method of the GraphicsEnvironment class, which technically returns an array of all the font family names it finds on the local system.

I like my platform freedom

As I've started to work on designing an HTML editor I'd like for the Mac platform, a little irony has set in: I find that I don't want to write it in Objective C. Given my history with Java, I find that I don't want to be tied to one platform, even Mac OS X. What if I install Ubuntu later this week (as scheduled) and fall madly in love with it? I want my application to work there also.