I like to learn about different development languages. When I have an idea for something cool or useful, I do the research and try to do it on my own. Not every language is suited to the task I think of, as a result I have developed a varying level of fluency in multiple languages.
Learning the language is fun, but I am not a fan of having to learn a different IDE for each one. Quite a while ago, I started using Eclipse for my web and scripting projects. It has all of the capabilities I need, project management, syntax highlighting, test and debugging, publishing and much more. There are times when Eclipse cannot be the IDE of choice (*cough* Visual Studio), but for the most part it’s my first stop.
I recently installed Windows 7 64-bit on my computer and as a result needed to reinstall all of my software. When I originally had Vista on this computer, Eclipse did not have a 64-bit version released. So the install was pretty straight forward. Download Java Runtime Environment (JRE) and Eclipse, it all worked nicely. Now, the interesting thing about this is that on both 64-bit versions of Vista and Windows 7 the default Internet Explorer is the 32bit version. When you download Java, it uses your browser to detect the version to install and, as a result, installs 32-bit JRE.
After downloading Eclipse 64-bit, I unzipped it and double clicked the application. I then received the following message:
A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. No Java virtual machine was found after searching the following locations:
javaw.exe in your current PATH
I tracked down javaw.exe in a different folder, C:\Program Files (x86)\Java\jre6\bin, and added that folder to my path and classpath environment variables. Running Eclipse again presented an error about a javavm.dll. So, my favorite programming tool is being difficult… Interesting.
Now, before any Eclipse users decide to flame me about changing my path statements, I know it’s not the right way to do it. Eclipse has an ini file that is the correct place to make this change. Setting the -vm arguement in eclipse.ini can allow you to quickly change the Java version you are working with. There are a few rules around the format of eclipse.ini as well as the plaement of the -vm arguement.
Each option and each argument to an option must be on its own line.
All lines after -vmargs are passed as arguments to the JVM, so all arguments and options for eclipse must be specified before -vmargs (just like when you use arguments on the command-line)
The -vm option and its value (the path) must be on separate lines.
The value must be the full absolute path to the Java executable, not just to the Java home directory.
The -vm option must occur before the -vmargs option, since everything after -vmargs is passed directly to the JVM.
As a personal rule, before I edit any file, I make a copy of it and add the date to the name. This way I can recover if I mess things up completely.
When you are ready, locate your eclipse.ini. It should be in the same folder you unzipped Eclipse into. Open it using Notepad and add the following lines above the -vmargs line.
C:\Program Files (x86)\Java\jre6\bin\javaw.exe
Note that your path to javaw.exe might be different, and that the path does not have quotes in it.
Save the file and launch Eclipse.
Nothing happened. Eclipse did not open.
Here’s why: You have Eclipse 64bit and the Java installed was 32bit. (remember the default browser is IE 32bit).
The fix for this is pretty simple. In your All Programs menu, you have an option for Internet Exporer (64-bit). You need to run it and got to http://www.java.com and download the 64bit Java. The page will have 64-bit listed in several places.
Once you go through the install, you should have a new Java folder in your C:\Program Files. This is the 64-bit version of Java.
Now we need to go back to the eclipse.ini and point the -vm to the correct javaw.exe.
Once again, open the file in Notepad and change the -vm option so that it reflects your 64-bit javaw.exe location.
Save the file and open Eclipse.
If everything worked correctly, you should now see the splash screen and the prompt to configure your workspace. If not, check the path to your javaw.exe and the format of your eclipse.ini.
Java Install Website: http://www.java.com
Java Version FAQ: http://www.java.com/en/download/faq/java_win64bit.xml
Eclipsepedia (eclipse.ini): http://wiki.eclipse.org/Eclipse.ini
Eclipse Download: http://www.eclipse.org/downloads/