Class already defined -- same file, same line
Casey Marshall
csm@gnu.org
Mon Aug 30 20:43:00 GMT 2004
>>>>> "Ranjit" == Ranjit Mathew <rmathew@gmail.com> writes:
Ranjit> Starling wrote:
>> I was attempting to use gcj on a project the Sun java implementation
>> on Linux does particularly abysmally about, and received the following
>> error:
>> ---
>> ./project/OpenConnectionManager.java:46: error: Class `project.OpenConnectionMan
>> ager' already defined in project/OpenConnectionManager.java:46.
>> public final class OpenConnectionManager implements Checkpointed {
>> ^
>> ./project/OpenConnectionManager.java:98: confused by earlier errors, bailing out
>> make: *** [project/OpenConnectionManager.o] Error 1
>> ---
Ranjit> This bug should be fixed now on the mainline. If you can,
Ranjit> I would advise you to pull a CVS snapshot, compile it and
Ranjit> use it.
Ranjit> Otherwise, you can try playing with the order of the
Ranjit> files on the command line or using one file per
Ranjit> compiler invocation, but that might (most likely)
Ranjit> not fix the problem.
I believe a workaround for this problem is to specify the path to the
source file to be the same as the one that gets picked up
automatically. That is, I think if the OP specifies
'./project/OpenConnectionManager.java' on the compile command line
instead of 'project/OpenConnectionManager.java', then it should work.
In general it is nice to use an automake-style, where you have a
variable `srcdir' that is the relative path to the source directory
from your build directory, then give '-I$(srcdir)
$(srcdir)/path/to/Whatever.java'.
--
Casey Marshall || csm@gnu.org
More information about the Java
mailing list