Saturday, June 21, 2014

Setting up Java Eclipse IDE on Windows 7 and JRE

After installing and uninstalling both Eclipse and JRE (Java runtime environment) several times on a Windows 7 64-bit machine, I finally have a sequence I can recommend. In my case, I had to have my testing environment in eclipse be compatible with the runtime environment on a Windows Server 2008 R2 without access to the JRE on that machine. This meant it had to be JRE 1.6 and 32 bit. (Even though the default installation on the Windows 7 machine was JRE 1.7 and 64 bit). 1. Uninstall all the implementations of java from the control panel uninstall utility. 2. You can't uninstall the Eclipse IDE, you can just delete it. 3. Install the JRE (1.6.0.6) and verify it is working by going to the program file (x86) folder and/or the windows\syswow64 folder (these are where 32-bit programs reside on 64-bit machines) and from the command line java -version. You can also verify it's installed by going into control panel ->java->java->Application runtime settings->view. 4. Install the IDE but be sure to download the 32-bit version. I downloaded it to a mac, put it in dropbox, let it sync for about 20 minutes on the target machine, and then copied the whole folder (after renaming it eclipse_32_bit) from dropbox to desktop on Windows 7. You can still have eclipse_64_bit on the same machine, in another folder. 5. Launch the IDE, select a default workspace folder, open the workbench, and immediately go to Window->Preferences->Java->Installed JREs->Execution Evironments. 6. Click on JavaSE-1.6 and here is where the magic is. In the compatible JREs pane the freshly installed jre1.6.0.06 is there, and not only that (it is there for other execution environments) it says "perfect match". 7. Click the compatible jre1.6.0.06 checkbox. This should give you the correct JRE for testing your application within Eclipse.