title: How to run a jar file from the teamcity custom plugin code
body: <p>I am working on developing a plugin for teamcity . The requirement is to run a jar file from the code which does some custom operation. I tried with the below code, but its not working for me.Any ideas on how to run the jar, links to documentation or sample code will help me a lot to progress further</p>
  
  <pre><code>public class CustomBuildProcess extends BuildProcessAdapter
  {
  
  private static final String     jarDir = "\\plugins\\teamcity-custom-plugin-agent\\lib\\metrics-17.6.4.4.jar";
  
  @Override
  public void start()
  {
  buildStatus = startProcess();
  
  }
  
  private BuildFinishedStatus startProcess() throws IOException
  {
  
  final GeneralCommandLine cmd = new GeneralCommandLine();
  cmd.setExePath("java -jar C:\\BuildAgent"+jarDir);
  
  final ExecResult result = SimpleCommandLineProcessRunner.runCommand(cmd, new byte[0]);
  
  }
  </code></pre>