This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Cannot load class.


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 <abhi00@gmail.com> wrote:
> 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 ?
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]