Detecting existing layout

The source files for the company's product are laid out in one directory "src" and class files are output in another directory "bin":

Existing layout

  1. Select the menu item File > New > Project.... to open the New Project wizard.
  2. On the left pane of the first wizard page, select Java, and on the right pane, select Java Project. Click Next.
  3. On the next page, type "Product" in the Project name field. Uncheck Use default. Click Browse... and choose the "Product" directory.

    New Java Project external to workspace

  4. Click Next. Ensure that the source and output folders are detected.

    Auto-detection of source and output folders

    NOTE: The auto-detection works only if the source files contain the correct package statement, i.e. for "Main.java":

    package com.xyz;
    			

    Warning: If the preference Window > Preferences > Java > Compiler > Build Path > Scrub output folder on full build is checked, clicking Finish will scrub the "bin" directory in the file system before generating the class files.

  5. Click Finish.
  6. You now have a Java project with a "src" folder which contains the sources of the "Product" directory.

    Java perspective

Note: This solution creates a ".project" file and a ".classpath" file in the "Product" directory. If you do not wish to have these files in the "Product" directory, you should use linked folders as shown in the Sibling products in a common source tree section.

Related concepts

Java projects
Java views

Related tasks

Working with build paths
Creating a new Java project
Creating a Java project with source folders
Creating a new source folder
Using the Package Explorer

Related reference

New Java Project Wizard
Package Explorer View

Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved.