title: Invoke in the method in a File
body: <p>I have JAR file on my pc,
  Now I want to call a method in that jar file. But can't understand how (I'm getting errors, Im sure I did something wrong), thanks an advice</p>
  <pre><code>File file == new File(&quot;MyLocation&quot;);
  
  Class loadClass = Class.forName(&quot;myClass&quot;, true, file.getClass().getClassLoader());
  Method m = loadClass.getMethod(&quot;myMethod&quot;, Integer.class);
  m.setAccessible(true);
  m.invoke(loadClass.newInstance(), 1);
  m.setAccessible(false);
  
  </code></pre>