2.13. Using a Different Workspace

Problem

You want to use a nondefault workspace for an Eclipse project.

Solution

Uncheck the “Use default” checkbox when you name the project in the first pane of the New Project dialog, and fill in the directory you want to use instead.

Discussion

When you create a new Eclipse project, Eclipse stores it in its workspace directory by default. You can, however, make it use another directory, regardless of the type of Eclipse project you’re creating. To select a different location, uncheck the “Use default” checkbox when you name the new project in the first pane of the New Project dialog. Then fill in the directory you want to use instead.

You can see how this works in Figure 2-11, in which a new Java project is created and stored in the directory c:\myworkspace.

Creating a custom workspace

Figure 2-11. Creating a custom workspace

Using a nondefault workspace is a good idea in many cases. For example, you might be working with code on a network. In this case, you should store the code where other software can use it (in Chapter 8, we’re going to store and develop code where the Tomcat web server can find it, which means using the Tomcat installation’s webapps directory as the workspace). It’s also a good idea to use a nondefault workspace if you want to keep some software, as in a beta version you’re developing, separate from the current version of the software.

Get Eclipse Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.