Re: Why a simple package statement

From: Christophe Vanfleteren (c.v4nfl3t3r3n_at_pandora.be)
Date: 11/23/03


Date: Sun, 23 Nov 2003 15:34:47 GMT

lonelyplanet999 wrote:

>> > Sorry, the compilation failed again after I renamed
>> > c:\javapgm\l1\Level.java package name as "package l1.Level1;" and
>> > compiled the file from c:\javapgm i.e. c:\j2sdk1.4.1_01\bin\javac
>> > l1\Level1.java.
>> >
>>
>> Don't put capitals in packagenames (especially not the first letter), that
>> makes it confusing (by convention, only classes start with a capital
>> letter).
>
> It only confuses human reader, it shouldn't cause compilation error, right
> ?
Yes
>
>>
>>
>> Of course that is not going to work.
>> Your compiler is expecting a directory called l1/Level1, but in your case,
>> that is allready a class file.
>>
>> Take the following as a base rule when working with packages:
>> If you put a file in package aaaa.bbb, you'll need to put it in a
>> directory called aaa/bbb, and compile the class from the directory that
>> contains the aaa dir.
>
> Already put file Level1.java into c:\javapgm\l1 described above.
> Compilation failed.

Is the package statement in Level1.java "package l1;" ? That is the only
thing that will work of the Level1 file is in the c:\javapgm\l1 directory.

You said before that you changed it to "package l1.Level1;", so you'd also
have to move the file to the c:\javapgm\l1\Level1\Level1.java if you'd want
that to work.

>
>>
>> You cant just change a package statement and leave the file where it was
>> before.

-- 
Regards,
Christophe Vanfleteren


Relevant Pages

  • Re: Why a simple package statement
    ... > Don't put capitals in packagenames (especially not the first letter), ... It only confuses human reader, it shouldn't cause compilation error, right? ... > If you put a file in package aaaa.bbb, you'll need to put it in a directory ...
    (comp.lang.java.programmer)
  • Re: year not returned by Time::localtime
    ... internals of perl regarding memory management and hence the distinction ... Instead I suspect that you mean that the new package function should be ... Its not possible to disambiguate (identify the appropriate ... By the time I can explain it without confusing you, ...
    (perl.beginners)
  • Re: Sending a finished prorogram to others
    ... references are confusing. ... Two common ways to do this is to use the Package and Deployment Wizard ... The MSI is probably a better solution but it is not as intuitive IMO. ... Oh, and by the way, the installation packages can be modified to include ...
    (microsoft.public.vb.general.discussion)
  • Re: Classpath definition (Oh, bother...)
    ... Andrew Thompson wrote: ... > I found your explanation a bit confusing (all those ... Sorry about those confusing names... ... they all belong to package yhdistarivitparam. ...
    (comp.lang.java.help)
  • Re: Classpath definition (Oh, bother...)
    ... I found your explanation a bit confusing (all those ... swimming around in my head), but it occured to me that ... the package name was not referred to. ...
    (comp.lang.java.help)