blob: 597ed069e19263b6229f18bfd94c683d79d1021d [file]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<title>
Detecting existing layout
</title>
<link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
</head>
<body>
<h1>
Detecting existing layout
</h1>
<p>The source files for the company's product are laid out in one directory "src" and class files are output in another directory "bin":
</p>
<p><img src="../images/qs-DetectingExistingLayout.gif" width=507 height=284 alt="Existing layout">
</p>
<ol>
<li>Select the menu item <strong>File &gt; New &gt; Project...</strong>. to open the <strong>New Project</strong> wizard.
</li>
<li>
On the left pane of the first wizard page, select <strong>Java</strong>, and on the right pane, select <strong>Java Project</strong>.
Click <strong>Next</strong>.
</li>
<li>
On the next page, type &quot;Product&quot; in the <strong>Project name</strong> field.
Uncheck <strong>Use default</strong>. Click <strong>Browse...</strong> and choose the &quot;Product&quot; directory.
<p><img src="../images/qs-DetectingExistingLayout1.gif" width=500 height=507 alt="New Java Project external to workspace"></p>
</li>
<li>
Click <strong>Next</strong>. Ensure that the source and output folders are detected.
<p><img src="../images/qs-DetectingExistingLayout2.gif" width=500 height=507 alt="Auto-detection of source and output folders"></p>
<p>NOTE: The auto-detection works only if the source files contain the correct package statement, i.e. for &quot;Main.java&quot;:
<pre>
package com.xyz;
</pre>
</p>
<p>
<em>Warning: </em>If the preference <strong>Window &gt; Preferences &gt; Java &gt; Compiler &gt; Build Path &gt; Scrub output folder on full build</strong>
is checked, clicking <strong>Finish</strong> will scrub the &quot;bin&quot; directory in the file system before
generating the class files.
</p>
</li>
<li>Click <strong>Finish</strong>.
</li>
<li>
You now have a Java project with a &quot;src&quot; folder which contains the sources of the &quot;Product&quot; directory.
<p><img src="../images/qs-DetectingExistingLayout3.gif" width=556 height=407 alt="Java perspective"></p>
</li>
</ol>
<p>
<em>Note: </em>This solution creates a &quot;.project&quot; file and a &quot;.classpath&quot; file in the
&quot;Product&quot; directory. If you do not wish to have these files in the &quot;Product&quot; directory,
you should use linked folders as shown in the
<a href="qs-WorkingWithExistingLayout1.htm">Sibling products in a common source tree</a> section.
</p>
<p>
<img border="0" src="../images/ngrelc.gif" alt="Related concepts" width="159" height="27">
</p>
<p>
<a href="../concepts/concepts-3.htm">Java projects</a><br>
<a href="../tasks/tasks-6.htm">Java views</a><br>
</p>
<p>
<img src="../images/ngrelt.gif" alt="Related tasks" border="0" height="27" width="159">
</p>
<p>
<a href="../tasks/tasks-110.htm">Working with build paths</a><br>
<a href="../tasks/tasks-12.htm">Creating a new Java project</a><br>
<a href="../tasks/tasks-14.htm">Creating a Java project with source folders</a><br>
<a href="../tasks/tasks-26.htm">Creating a new source folder</a><br>
<a href="../tasks/tasks-45.htm">Using the Package Explorer</a><br>
</p>
<p>
<img src="../images/ngrelr.gif" width=159 height=27 alt="Related reference">
</p>
<p>
<a href="../reference/ref-121.htm">New Java Project Wizard</a><br>
<a href="../reference/ref-view-package-explorer.htm">Package Explorer View</a><br>
</p>
<p>
<a href="../hglegal2003.htm"><img src="../images/ngibmcpy2003.gif" width=324 height=14 alt="Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved." border="0"></a>
</p>
</body>
</html>