public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
From: abhishek desai <abhi00@gmail.com>
To: java@gcc.gnu.org
Subject: Cannot load class.
Date: Fri, 09 Oct 2009 06:01:00 -0000	[thread overview]
Message-ID: <898285d30910082301va1eae5co11a7e92ef12c7eb8@mail.gmail.com> (raw)

Hi

I am have a c++ file startup.cpp which tries to load a class com.abc.HelloWorld.

The  program is shown below.

void  _Jv_RunMain (jclass klass, const char *name, int argc, const
char **argv,  bool is_jar);


     int main(int argc, const char **argv)
     {
       JvVMInitArgs vm_args;
       bool jar_mode = false;
       vm_args.options = NULL;
       vm_args.nOptions = 0;
       vm_args.ignoreUnrecognized = true;

       using namespace java::lang;

       try
       {
         _Jv_RunMain( &vm_args, NULL, "com.abc.HelloWolrd", argc - 1,
(char const**) (argv + 1) , false);
       }
       catch (Throwable *t)
       {
         System::err->println(JvNewStringLatin1("Unhandled Java exception:"));
         t->printStackTrace();
       }
    }

I have compiled this program and put it in directory xyz

The hello world program is as below.

package com.abc;

public class HelloWorld
{
    public static void main(String args[])
    {
         System.out.println("Inside HelloWorld main.");
    }
}

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 ?

             reply	other threads:[~2009-10-09  6:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-09  6:01 abhishek desai [this message]
2009-10-09  6:26 ` abhishek desai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=898285d30910082301va1eae5co11a7e92ef12c7eb8@mail.gmail.com \
    --to=abhi00@gmail.com \
    --cc=java@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).