Java path to Program Files folder in windows 64bit

64-bit, java, program-files

Solution

You should be using

System.getenv("ProgramFiles(X86)")

You can find the full reference on Wikipedia.

Problem

i`m trying to get the default Program Files folder on java. When I use: ``` System.getenv("ProgramFiles") ``` It returns "C:\Program Files" instead of "C:\Program Files (x86)" I can add manually +(x86) but if the user will use 32bit system it will be the wrong folder.

Original source