Cannot load class.

abhishek desai
Fri Oct 9 06:01:00 GMT 2009


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

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;

         _Jv_RunMain( &vm_args, NULL, "", argc - 1,
(char const**) (argv + 1) , false);
       catch (Throwable *t)
         System::err->println(JvNewStringLatin1("Unhandled Java exception:"));

I have compiled this program and put it in directory xyz

The hello world program is as below.


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

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" . The class is loaded and its main function is

what could be wrong ?

More information about the Java mailing list