Re: Cannot load class.
abhishek desai <[email protected]>
| Newsgroups | gmane.comp.gcc.java.devel |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> 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 ? >