If you’re running a graphical desktop environment such as Gnome or KDE, you can create a custom launch button for Eclipse in the tool panel by following these instructions:
Gnome
1. Right-click on the tool panel.
2. Select Add to Panel→Custom Application Launcher.
3. Fill in the pop-up dialog box:
Name: Eclipse 3.4
Generic Name: Eclipse
Comment:
Command: /<path_to_eclipse>/eclipse
4. Select an appropriate icon.
5. Click OK.
KDE
1. Right-click on the tool panel.
2. Select Add→Special Button→Non-KDE Application.
3. Fill in the pop-up dialog box:
Executable: /<path_to_eclipse>/eclipse
Optional command line arguments:
4. Select an appropriate icon.
5. Click OK.
Then to start Eclipse, simply click on the launch button.
Go ahead and give it a try using any of the three mechanisms cited above. If you get to the screen shown in Figure 2.2, Eclipse is working. Click Cancel to terminate. You can skip the rest of this chapter and move on to the next, unless you want to try out Eclipse under Windows. If Eclipse failed to launch, it’s probably because the JVM is either not present or not compatible. Continue with the next section.
Figure 2.2: Workspace selection dialog.
2.3.1 Installing and Using a Java Virtual Machine (JVM)
JVMs can be downloaded from http://www.java.com/en/. Click on the Free Java Download button. This takes you to a Java Downloads for Windows page. Click on All Java Downloads. This brings up a page with downloads of the latest releases of Solaris, Linux, and Mac OS, as well as Windows. At the time this was being written, the latest release was Java 6 update 3. While Eclipse does not officially support this version, it does appear to work OK. Other versions of Java are available by clicking on Other Java Versions.
Download the Linux (self-extracting) file to the same directory where you downloaded Eclipse. The file is an executable, so execute it. You’ll be asked to read and accept the Sun Microsystems Binary Code License Agreement for the Java SE runtime environment (JRE) version 6. The JVM is then extracted to jre1.6.0_03/
. Note that if you choose to use a different version, the directory name changes accordingly.
To be sure the new version of the Java is the one that gets executed, it must appear in your path before the default version. You can add /<path_to_jvm>/bin
to the beginning of your $PATH environment variable. Or you can create a link to the new Java executable in a directory that already appears in your $PATH
ahead of the directory holding the default version.
Execute the shell command whereis java
to determine where the default version is located. Then execute echo $PATH to find a suitable directory that appears earlier in your path. In my case, the default java is in /usr/bin
and it turns out that /usr/local/bin
shows up just ahead of that. So I put a link to /usr/local/jre1.6.0_03/bin/java
in /usr/local/bin
.
You can skip the rest of this chapter and move on to the next, unless you want to try out Eclipse under Windows.
2.4 Installing Eclipse Under Windows
Go back to the Eclipse downloads page, but this time select the Windows link and download the file to an appropriate destination directory. In this case the file is a .zip
that must be opened with WinZip. Extract the .zip
file to the directory of your choice. This results in almost the same directory structure as that shown in Figure 2.1. The about_files/
subdirectory is missing.
Start Eclipse from a file manager window by double-clicking eclipse.exe
in the eclipse/
directory. If your Windows system has a JVM, and most likely it does, you should see a screen like Figure 2.3. For now, click Cancel.
Figure 2.3: Workspace selection dialog under Windows.
You’ll probably want to create a shortcut on the desktop for starting Eclipse. Rightclick on eclipse.exe
and select Create Shortcut. This creates a shortcut in the eclipse/
directory. Drag that over to the desktop.
Note incidentally that Eclipse does not use the standard Windows program installation mechanism, and it doesn’t put anything into the Windows registry. To uninstall Eclipse, simply delete the eclipse/
directory.
2.4.1 Installing a JVM
If Eclipse did not start correctly, your system may not have a JVM. Go to http://java.com/en and click the Free Java Download button. Java offers two different mechanisms for installation under Windows — online and offline. Clicking the link Windows XP/Vista/2000/2003 Online downloads a small (360 KB) executable, jre6u3-windows-i586-p-iftw.exe
. This program in turn installs the rest of the JVM from the web.
You are given the opportunity to view, and then either to accept or to decline the terms of the Java license. Assuming you accept, the installation proceeds without any further user input required.
Alternatively, you can click Windows XP/Vista/2000/2003 Offline, which downloads a much larger (about 13.8 MB) executable, jre-6u3-rc-windows-i586.exe
. This is the entire JVM package. The offline installation offers additional options—the Google toolbar and desktop—and more control over the installation process. A custom setup screen allows you to select the options to be installed. Unless you’re an “advanced” user, it’s probably best to accept the defaults.
Following installation, restart your browser and go back to http://java.com/en/. Select the Advanced tab and click the link Do I have Java? to bring up the Verify Installation page. Click the Verify Installation button. This should confirm that the JVM is properly installed. If not, you may need to configure the JVM.
Open the Windows Control Panel and double-click the Java icon (the coffee cup). Select the Advanced tab and click on the + next to Default Java for browsers. Check all the boxes on that branch to enable Java for the web browsers on your system.
2.5 Embedded Software Development on Windows
Remember that our objective here is to use Eclipse for developing software for embedded devices, with an emphasis on those that are Linux-based. While it is possible to do embedded development under Windows, it’s somewhat more difficult because Windows, by itself, lacks a number of tools and services that are necessary, or at least highly desirable, for embedded software development.
Windows XP, other than the server edition, lacks network server facilities such as NFS (network file system) and TFTP (trivial file transfer protocol) that are very useful for debugging code on a target board. But most importantly, Windows lacks a tool chain for building software — a compiler, linker, assembler, libraries, etc.
The most widely used tool chain for embedded development is the GNU tool chain, which comes standard with just about every Linux distribution. There are two common approaches to adding a GNU tool chain to Windows: Cygwin and MinGW.