From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10307 invoked by alias); 20 Jan 2011 09:08:40 -0000 Received: (qmail 10294 invoked by uid 22791); 20 Jan 2011 09:08:39 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,TW_GC,TW_IB X-Spam-Check-By: sourceware.org Received: from mail-qw0-f47.google.com (HELO mail-qw0-f47.google.com) (209.85.216.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 20 Jan 2011 09:08:33 +0000 Received: by qwi2 with SMTP id 2so327657qwi.20 for ; Thu, 20 Jan 2011 01:08:31 -0800 (PST) MIME-Version: 1.0 Received: by 10.229.251.209 with SMTP id mt17mr1547389qcb.66.1295514511805; Thu, 20 Jan 2011 01:08:31 -0800 (PST) Received: by 10.229.136.207 with HTTP; Thu, 20 Jan 2011 01:08:31 -0800 (PST) In-Reply-To: References: Date: Thu, 20 Jan 2011 09:08:00 -0000 Message-ID: Subject: Re: a question about directory structure of libjava From: Bryce McKinlay To: majia gm Cc: gcc-help@gcc.gnu.org, Java List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact java-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-owner@gcc.gnu.org X-SW-Source: 2011-01/txt/msg00012.txt.bz2 On Thu, Jan 20, 2011 at 8:50 AM, majia gm 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. > =A0But there's often no implementation of methods in C++. > =A0Dose 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