Re: Why a simple package statement

From: Christophe Vanfleteren (
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\ package name as "package l1.Level1;" and
>> > compiled the file from c:\javapgm i.e. c:\j2sdk1.4.1_01\bin\javac
>> > l1\
>> >
>> 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
> ?
>> 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 into c:\javapgm\l1 described above.
> Compilation failed.

Is the package statement in "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\ if you'd want
that to work.

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

Christophe Vanfleteren