This is the correct answer for 32-bit Program Files directory
System.getenv("ProgramFiles(X86)")
However if a programmer is looking for the 64-bit Program Files folder but running a 32-bit JVM, System.getenv("ProgramFiles") will return "\Program Files (x86)\" as a side effect of 32-bit compatibility. In some cases, a programmer will still want the 64-bit ProgramFiles directory. This solution has its flaws, but will usually work...
System.getenv("ProgramFiles").replace(" (x86)", "")
Which is only marginally better then
System.getenv("SystemDrive") + "\Program Files"
-Tres