Re: Why a simple package statement
From: Christophe Vanfleteren (c.v4nfl3t3r3n_at_pandora.be)
Date: Sun, 23 Nov 2003 15:34:47 GMT
>> > 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
> 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 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
-- Regards, Christophe Vanfleteren