For Java apps to run in Windows, a JRE (Java Runtime Environment) must be installed. If it’s installed, but your Java apps are throwing errors that it cannot find the JRE, then you will need to add an environment variable to point to the Java bin directory.
Here is a screenshot of such an error I received when trying to run the Android SDK:
(Also notice the typo in the above message: “Checking it it’s installed in …”)
Below are instructions for fixing this error on Windows 7 x64 with the 64-bit JRE installed:
- Click the “Start Orb”, and type:
- In the search results, you should see “System” appear. Click on it, and you should have the “View basic information about your computer window” appear.
- In that window, on the left hand side, you should see a link to “Advanced system settings”. Click it. (Accept all UAC prompts)
- The “System Properties” window will appear. Click the “Advanced” tab.
- On the “Advanced” tab, click the button towards the bottom of the window titled “Environment Variables…”
- The “Environment Variables” window should appear. In this window, on the bottom half, you should see a section titled: “System variables”. Scroll down that list for an entry titled:
Path. Click the “Edit” button.
- The “Edit System Variable” window should appear. In this window, select the textbox for “Variable value:”. Scroll to the end of the entry, and add a semicolon (;) to the end of the line (assuming no semicolon is currently there).
- You will then need to locate where your Java bin directory is located. For me, on 64-bit Windows 7 with the 64-bit JRE installed, it is located in the following path:
C:\Program Files\Java\jre6\bin(This is the default location if installing the 64-bit JRE)
- Copy and paste the path to the bin directory after the semicolon we just added to the “Variable value:” textbox.
- Click OK to all the windows, and your application should work.