This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: a question about directory structure of libjava
- From: Bryce McKinlay <bmckinlay at gmail dot com>
- To: majia gm <gmmajia at gmail dot com>
- Cc: gcc-help at gcc dot gnu dot org, Java List <java at gcc dot gnu dot org>
- Date: Thu, 20 Jan 2011 09:08:31 +0000
- Subject: Re: a question about directory structure of libjava
- References: <AANLkTin+w60eM7f4LjE4v2gE2UVAL1AiExdExARtcbzT@mail.gmail.com>
On Thu, Jan 20, 2011 at 8:50 AM, majia gm <gmmajia@gmail.com> wrote:
>
> I'm new to gcj. And I'm reading the source code in the directory of
> libjava. I'm a little confused by the structure of the directory.
>
> I found that there often exists two java files, which have much
> differnce in content, having the same name in different directories.
> Such as,
>
> libjava/java/lang/Class.java
> libjava/classpath/java/lang/Class.java
>
> Will both of them be used?
The files in libjava/classpath are directly imported from the GNU
Classpath project. In some cases, such as this one, libjava overrides
classpath's classes with its own.
> I also found C++ files libjava/java/lang/Class.h, which declares the
> class Class in C++ corresponding to Class.java.
> And libjava/java/lang/natClass.cc, which implements the native methods.
Right, the .h files are generated by the gcjh tool.
> ?But there's often no implementation of methods in C++.
> ?Dose the method code come from the Java file? How dose this happen?
In some cases the native methods are implemented by the GNU Classpath
code in JNI (C), rather than CNI (C++). These implementations can be
found under libjava/classpath/native/jni.
Bryce