title: JNI: Creating method id's for class constructors that have fields/classes from in the program as parameters
body: <p>Title may sound confusing, but allow me to explain.. I'm trying to create a little dll hack for a game using C++. In order to call non-static functions from a class, you need the class constructor as a method id. The problem I'm having is the parameters for the constructor of the class I want to call a method from are other fields from in the game... </p>
  
  <p>Here's an example, let's say this is in a class called Minecraft...</p>
  
  <pre><code>public Minecraft(GameSetting setting, EntityPlayer player, Example example)
  {
      .....
  }
  </code></pre>
  
  <p>How would I go about creating a method id for something like that? Is there a more effecient way than creating more jclasses (GameSetting, etc) and then trying to create jobjects for those, but then having to find the parameters for their constructors too? If so, it would take months to travel around the entire program, creating jobjects for everything... </p>
  
  <p>Anyway, here's my actual dll, maybe there's a way around getting the constructor all together? I'm not experienced enough with the java native interface or C++ to come up with a good solution...</p>
  
  <p>Dll (Am simply trying to call the clickMouse function as an example):</p>
  
  <pre><code>jclass Minecraft = env-&gt;FindClass("net.minecraft.client.Minecraft");
  jmethodID constructor = env-&gt;GetStaticMethodID(Minecraft, "&lt;init&gt;", "()Minecraft");//In the () there are supposed to be a few variables from Minecraft.
  
  jobject mcObj = env-&gt;NewObject(Minecraft, constructor); //Creates the object
  jmethodID clickMouse = env-&gt;GetMethodID(Minecraft, "clickMouse", "()V"); //Creates the callable method
  
  while (!GetAsyncKeyState(VK_END))
  {
      env-&gt;CallVoidMethod(mcObj, clickMouse); //End result what I want to do is call the method, but since it isn't static I need an object, which means I need to get the class constructor :/
  }
  </code></pre>