Using StartJnjvmWithJIT from jnjvm.cpp in VMKit

Does anybody use StartJnjvmWithJIT from jvjvm.cpp in VMKit? Becuase , I am looking to use without JIT when we are running the Java byte code. My concern is StartJnjvmWithJIT getting three argument int argc, char** argv, char* mainClass - why we need to pass argv and mainclass arguments here?

please help me on this.



Basically, generateMain (JavaAOTCompiler.cpp) generate the C main
function when you compile a Java application with the AOT. And
generateMain invokes the main of the Java application, which is fixed
during the compilation: this main class is simply the main method of
the Main-Class of the jar file (or an argument that you give through
the command line when you invoke the AOT compiler). After, at runtime,
when you invoke the main of the Java application, you have to fill the
arguments of the Java application, and they are given through the
command line. To summarize, the main function looks like this:

int main(int argc, char** argv) {
  StartJnjvmWithJIT(argc, argv, "TheMainClassOfTheCompiledApplication");

argc and argv are the arguments given at runtime, the main class is
the argument of the AOT compiler.


Hi Gael
Thank you for your clarification. I have generated .bc from vmjc by giving java byte code , now generated .bc having StartJnjvmWithoutJIT function. So , I write a simple application as you mentioned and passed the mainclass as “HelloWorld” and argv is nothing since my java program not taking any arguments. I am getting following error
j3: JavaRuntimeJIT.cpp:381: void *j3ResolveVirtualStub(j3::JavaObject *): Assertion `FI->Metadata != __null && “Wrong stack trace”’ failed.
Aborted (core dumped)
Am I missing anything here.