Prevent the scheduled executor from creating multiple instances of a java process

I have created a scheduled task that executes a call to an external .jar file that creates XML files. I wish this operation to run every 4 minutes.
Whenever the external .jar file is executed, a new instance is created, but I want to close the existing instance and create a new one.

basically it's my code:

RunInvoiceProcesses (props properties) private static voids {
ScheduledExecutorService executorService =
Executors.newScheduledThreadPool (executorService.scheduleAtFixedRate (new)
Runnable () {
@Override
public void run () {

Runtime.getRuntime (). Exec ("cmd / c calls C: \ creinvoice \ XMLGen \ runxmlgen.bat");


}
}
15
240
TimeUnit.SECONDS);

// the .bat simply calls java -jar myapp.jar

and it is the one that should only be executed one instance at a time.
Whenever this executable is executed, it calls the bat and a new instance is created by the Java virtual machine.

I've tried to create an instance of Process outside the executor and do something like that

Process xmlGeneration = null;

Runnable () {
@Override
public void run () {
if (xmlGeneration.stillAlive ()) {xmlGeneration.Destroy ();}
xmlGeneration = Runtime.getRuntime (). exec ("cmd / c call C: \ creinvoice \ XMLGen \ runxmlgen.bat");


}
}

but it seems that you can only introduce final variables into the runnable, which is impossible.
Of course, I tried to do everything I could about it, but if you could at least head in the right direction, I would really appreciate it!