Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Why directory structure is enforced?
Why directory structure is enforced? [message #188514] Fri, 03 December 2004 17:34 Go to next message
Eclipse UserFriend
Hi! Here's the problem. I'm writing code that belongs to the package, say,
"com.company.project.util".

And I want to keep this code in CVS directory, say,
/src/project/util/java. And I want to put all .java files right there in
this directory, without that nested directory tree
"com/company/project/util".

Eclipse doesn't like that. It gives me the error "The declared package
does not match the expected package com.company.project.util".

IS there any way to fix that? Do Eclipse developers plan to allow
arbitrary source paths?

Thanks
Andrew
Re: Why directory structure is enforced? [message #188541 is a reply to message #188514] Fri, 03 December 2004 23:03 Go to previous messageGo to next message
Eclipse UserFriend
Andrew wrote:
> Hi! Here's the problem. I'm writing code that belongs to the package,
> say, "com.company.project.util".
>
> And I want to keep this code in CVS directory, say,
> /src/project/util/java. And I want to put all .java files right there in
> this directory, without that nested directory tree
> "com/company/project/util".
>
> Eclipse doesn't like that. It gives me the error "The declared package
> does not match the expected package com.company.project.util".
>
> IS there any way to fix that? Do Eclipse developers plan to allow
> arbitrary source paths?

It's worked like this in Java since version 1. (Of Java!)

Get used to it.

--
Alex
Re: Why directory structure is enforced? [message #188555 is a reply to message #188541] Sat, 04 December 2004 20:41 Go to previous messageGo to next message
Eclipse UserFriend
It seems to me that java works like it for class files, not for source
files. If I remember well the time when I used javac and a plain text
editor, my source files could all be in the same directory but belong to
different packages.

Alex Fitzpatrick wrote:
> Andrew wrote:
>
>> Hi! Here's the problem. I'm writing code that belongs to the package,
>> say, "com.company.project.util".
>>
>> And I want to keep this code in CVS directory, say,
>> /src/project/util/java. And I want to put all .java files right there
>> in this directory, without that nested directory tree
>> "com/company/project/util".
>>
>> Eclipse doesn't like that. It gives me the error "The declared package
>> does not match the expected package com.company.project.util".
>>
>> IS there any way to fix that? Do Eclipse developers plan to allow
>> arbitrary source paths?
>
>
> It's worked like this in Java since version 1. (Of Java!)
>
> Get used to it.
>
Re: Why directory structure is enforced? [message #188562 is a reply to message #188555] Sat, 04 December 2004 22:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: varavamu.yahoo.com

hi Guillaume,
yes - you are correct in that when using the 'javac' command-line tool, all your
sources could be located in same directory. But, afaik, physically separating
them based on the package structure allows for lot easier maintenance. Eclipse
just enforces this as a rule.

HTH,
Vijay

Guillaume Pothier wrote:
> It seems to me that java works like it for class files, not for source
> files. If I remember well the time when I used javac and a plain text
> editor, my source files could all be in the same directory but belong to
> different packages.
>
> Alex Fitzpatrick wrote:
>
>> Andrew wrote:
>>
>>> Hi! Here's the problem. I'm writing code that belongs to the package,
>>> say, "com.company.project.util".
>>>
>>> And I want to keep this code in CVS directory, say,
>>> /src/project/util/java. And I want to put all .java files right there
>>> in this directory, without that nested directory tree
>>> "com/company/project/util".
>>>
>>> Eclipse doesn't like that. It gives me the error "The declared
>>> package does not match the expected package com.company.project.util".
>>>
>>> IS there any way to fix that? Do Eclipse developers plan to allow
>>> arbitrary source paths?
>>
>>
>>
>> It's worked like this in Java since version 1. (Of Java!)
>>
>> Get used to it.
>>
Re: Why directory structure is enforced? [message #188576 is a reply to message #188555] Sun, 05 December 2004 15:40 Go to previous message
Eclipse UserFriend
Originally posted by: not_real.not_real.com

This is not entirely true. In order for javac to be able to
automatically find and compile other java classes that a file depends
on, it relies on a sourcepath directory structure that matches the
package structure.

Guillaume Pothier wrote:
> It seems to me that java works like it for class files, not for source
> files. If I remember well the time when I used javac and a plain text
> editor, my source files could all be in the same directory but belong to
> different packages.
>
> Alex Fitzpatrick wrote:
>
>> Andrew wrote:
>>
>>> Hi! Here's the problem. I'm writing code that belongs to the package,
>>> say, "com.company.project.util".
>>>
>>> And I want to keep this code in CVS directory, say,
>>> /src/project/util/java. And I want to put all .java files right there
>>> in this directory, without that nested directory tree
>>> "com/company/project/util".
>>>
>>> Eclipse doesn't like that. It gives me the error "The declared
>>> package does not match the expected package com.company.project.util".
>>>
>>> IS there any way to fix that? Do Eclipse developers plan to allow
>>> arbitrary source paths?
>>
>>
>>
>> It's worked like this in Java since version 1. (Of Java!)
>>
>> Get used to it.
>>
Previous Topic:Code generation
Next Topic:debuggee - debugger communication in eclipse
Goto Forum:
  


Current Time: Sun Jun 08 03:40:48 EDT 2025

Powered by FUDForum. Page generated in 0.03007 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top