From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24812 invoked by alias); 9 Oct 2009 06:26:18 -0000 Received: (qmail 24798 invoked by uid 22791); 9 Oct 2009 06:26:17 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-yx0-f195.google.com (HELO mail-yx0-f195.google.com) (209.85.210.195) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 09 Oct 2009 06:26:10 +0000 Received: by yxe33 with SMTP id 33so10837399yxe.0 for ; Thu, 08 Oct 2009 23:26:08 -0700 (PDT) MIME-Version: 1.0 Received: by 10.90.16.14 with SMTP id 14mr1251038agp.37.1255069568237; Thu, 08 Oct 2009 23:26:08 -0700 (PDT) In-Reply-To: <898285d30910082301va1eae5co11a7e92ef12c7eb8@mail.gmail.com> References: <898285d30910082301va1eae5co11a7e92ef12c7eb8@mail.gmail.com> Date: Fri, 09 Oct 2009 06:26:00 -0000 Message-ID: <898285d30910082326r528937dbv6336b378aa63934@mail.gmail.com> Subject: Re: Cannot load class. From: abhishek desai To: java@gcc.gnu.org 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: 2009-10/txt/msg00033.txt.bz2 Sorry.. There was a spelling mistake in the class name HelloWolrd instead of HelloWorld. On Fri, Oct 9, 2009 at 11:31 AM, abhishek desai wrote: > Hi > > I am have a c++ file startup.cpp which tries to load a class com.abc.Hell= oWorld. > > The =A0program is shown below. > > void =A0_Jv_RunMain (jclass klass, const char *name, int argc, const > char **argv, =A0bool is_jar); > > > =A0 =A0 int main(int argc, const char **argv) > =A0 =A0 { > =A0 =A0 =A0 JvVMInitArgs vm_args; > =A0 =A0 =A0 bool jar_mode =3D false; > =A0 =A0 =A0 vm_args.options =3D NULL; > =A0 =A0 =A0 vm_args.nOptions =3D 0; > =A0 =A0 =A0 vm_args.ignoreUnrecognized =3D true; > > =A0 =A0 =A0 using namespace java::lang; > > =A0 =A0 =A0 try > =A0 =A0 =A0 { > =A0 =A0 =A0 =A0 _Jv_RunMain( &vm_args, NULL, "com.abc.HelloWolrd", argc -= 1, > (char const**) (argv + 1) , false); > =A0 =A0 =A0 } > =A0 =A0 =A0 catch (Throwable *t) > =A0 =A0 =A0 { > =A0 =A0 =A0 =A0 System::err->println(JvNewStringLatin1("Unhandled Java ex= ception:")); > =A0 =A0 =A0 =A0 t->printStackTrace(); > =A0 =A0 =A0 } > =A0 =A0} > > I have compiled this program and put it in directory xyz > > The hello world program is as below. > > package com.abc; > > public class HelloWorld > { > =A0 =A0public static void main(String args[]) > =A0 =A0{ > =A0 =A0 =A0 =A0 System.out.println("Inside HelloWorld main."); > =A0 =A0} > } > > I have compiled this file to a class file and put it in the directory > xyz/com/abc > > I change dir to xyz > When I execute the "startup" program, it thows a class not found > exception. When I try to lead the same class using the command "gij > com.abc.HelloWorld" . The class is loaded and its main function is > executed. > > what could be wrong ? >