Running a jar file from the teamcity plugin code

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

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("C:\\BuildAgent"+jarDir);

final ExecResult result = SimpleCommandLineProcessRunner.runCommand(cmd, new byte[0]);

}

Please sign in to leave a comment.