#include #include "classfile.h" int execute(ClassFile *cf, Method *m, int *args, int argc); int main(int argc, char *argv[]) { if (argc < 2) { fprintf(stderr, "usage: %s \n", argv[0]); return 1; } /* step 1 - load the class file */ ClassFile *cf = classfile_load(argv[1]); if (!cf) return 1; /* step 2 - find the main method */ Method *m = classfile_find_method(cf, "main", "([Ljava/lang/String;)V"); if (!m) m = classfile_find_method(cf, "startApp", "()V"); if (!m) { fprintf(stderr, "no main or startApp method found\n"); return 1; } /* step 3 - execute it */ execute(cf, m, NULL, 0); classfile_free(cf); return 0; }