<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dushyanth Jyothi &#187; Java</title>
	<atom:link href="http://dushi.co.uk/tag/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://dushi.co.uk</link>
	<description>Me, My Life and the Binary</description>
	<lastBuildDate>Wed, 11 Apr 2012 15:45:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Error: Path for project must have only one segment</title>
		<link>http://dushi.co.uk/09/07/2009/error-path-for-project-must-have-only-one-segment/</link>
		<comments>http://dushi.co.uk/09/07/2009/error-path-for-project-must-have-only-one-segment/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 17:58:32 +0000</pubDate>
		<dc:creator>Dushyanth Jyothi</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[eclipse]]></category>

		<guid isPermaLink="false">http://dushi.co.uk/?p=34</guid>
		<description><![CDATA[Error: Path for project must have only one segment Even Though google shows 995,000 pages containg the text &#8220;Path for project must have only one segment&#8221; &#8211; None of them really explains what this error mean &#8211; Except if you look at the source code of WorkspaceRoot class, particularly &#8216;getProject&#8217; method: This problem usually occurs [...]]]></description>
			<content:encoded><![CDATA[<p>Error: Path for project must have only one segment</p>
<p>Even Though google shows 995,000 pages containg the text &#8220;Path for project must have only one segment&#8221; &#8211; None of them really explains what this error mean &#8211; Except if you look at the source code of WorkspaceRoot class, particularly &#8216;getProject&#8217; method:</p>
<p>This problem usually occurs when you try to access a project  name/path,etc, when it is not avialable or you might have forget to instantiate the IProject object or try to  instantiate the IProject with different name.</p>
<p>Solution: Have a look at your code where you are calling</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">getProject.</pre></div></div>

<p>Check names, paths are called correctly.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> IProject getProject<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> JavaDoc name<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #666666; font-style: italic;">//first check our project cache</span>
 Project result <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>Project<span style="color: #009900;">&#41;</span> projectTable.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>name<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
       <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>result <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            IPath projectPath <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Path<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">null</span>, name<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">makeAbsolute</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #003399;">String</span> JavaDoc message <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Path for project must have only one segment.&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//$NON-NLS-1$</span>
 <span style="color: #000000; font-weight: bold;">Assert</span>.<span style="color: #006633;">isLegal</span><span style="color: #009900;">&#40;</span>projectPath.<span style="color: #006633;">segmentCount</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> ICoreConstants.<span style="color: #006633;">PROJECT_SEGMENT_LENGTH</span>, message<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #666666; font-style: italic;">//try to get the project using a canonical name</span>
 <span style="color: #003399;">String</span> JavaDoc canonicalName <span style="color: #339933;">=</span> projectPath.<span style="color: #006633;">lastSegment</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            result <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>Project<span style="color: #009900;">&#41;</span> projectTable.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>canonicalName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
             <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>result <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
                 <span style="color: #000000; font-weight: bold;">return</span> result<span style="color: #339933;">;</span>
            result <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Project<span style="color: #009900;">&#40;</span>projectPath, workspace<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            projectTable.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span>canonicalName, result<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
       <span style="color: #009900;">&#125;</span>
         <span style="color: #000000; font-weight: bold;">return</span> result<span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span></pre></div></div>

<div id="TixyyLink" style="border: medium none; overflow: hidden; color: #000000; background-color: transparent; text-align: left; text-decoration: none;">Read more: &#8220;Java > Open Source Codes > org > eclipse > core > internal > resources > WorkspaceRoot _ Java API By Example, From Geeks To Geeks.&#8221; &#8211; <a href="http://kickjava.com/src/org/eclipse/core/internal/resources/WorkspaceRoot.java.htm#ixzz0H1TWbu8u&#038;A">http://kickjava.com/src/org/eclipse/core/internal/resources/WorkspaceRoot.java.htm#ixzz0H1TWbu8u&#038;A</a></div>
]]></content:encoded>
			<wfw:commentRss>http://dushi.co.uk/09/07/2009/error-path-for-project-must-have-only-one-segment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

