#205 incorrect package name

closed
None
5
2012-10-08
2004-04-27
No

source : CVS Head
config : PC + Windows 98 + JDK 1.4.2_04

sumup : incorrect package name

In the CDK project, you may find a package called "jmol-
applet" which is located in the "src" folder and which
contains other packages.

This name is not an appropriate package name, the
reason is exposed in the following quotation.

[quote]
The format of the package declaration is quite simple.
The keyword package occurs first and is followed by
the package name. The package name is a series of
elements separated by periods. When class files are
created, they must be placed in a directory hierarchy
that reflects their package names. You must be careful
that each component of your package name hierarcht is
a legitimate directory name on all platforms. Therefore,
you must not use characters such as space, forward
slash, backslash, or other symbols. Use only
alphanumeric characters in package names.
[/quote]

Philip Heller, Simon Roberts
Complete Java 2 Certification study guide 4th edition,
SYBEX
2004
ISBN 0-7821-4276-1

Yours.
M.

Discussion

  • Logged In: YES
    user_id=25678

    That directory is actually not really the start of the
    package name. The dir contains classes that replace to
    original class so that the class can be used in an applet,
    the Jmol applet in this case.

     
  • Logged In: YES
    user_id=935018

    Hello Egon.

    Do you mean that the jmol-applet folder is actually not a
    simple package folder but a source folder and plays the
    same role as the src folder which is also a source folder?
    Note that, by source folder, I mean [quote] The location of
    source files. [/quote] (eclipse terminology).

    If so, there is one thing that you need to be aware of: (see
    eclipse help about "New source folder wizard")
    [quote]Note that a new source folder cannot be nested in
    existing source folders or in an output folder. You can choose
    to add exclusion filters to the other nesting source folders or
    the wizard will suggest to replace the nesting classpath entry
    with the new created entry. The wizard will also suggest to
    change the output location.[/quote]

    Within eclipse, I tried to create a new source folder in the
    src source folder hierarchy, but whatever I do, the folder
    are always created as a src folder's brother and not as a
    src folder's son as expected.

    The little problem is that all folders in the src source folder
    hierarchy are automatically recognised as package folders so
    the jmol-applet folder is automatically recognised as being
    part of the package name and this leads to the error I
    mentioned as a bug in my first message.

    Note that this error also causes chain-reaction error
    detection (i.e. package name doesn't fit with package name
    declaration, automatic compilation doesn't work correctly for
    the jmol-applet hierarchy, and other errors that are not as
    important as this last one.) Of course, I still have the ant
    option but I don't see any interest using ant to check that
    the class I'm working on just compile correctly.

    Anyway, as I do not work on source code that is part of the
    jmol-applet folder hierarchy, this is not really important.

    At last, I don't want you to change anything in the project; I
    just want you to be aware of this eclipse problem. ;-)

    Yours.
    M.