Have you tried something like this,
Create java file
use ProcessBuilder and run the new JVM.
Here's what you need to get started:
ProcessBuilder pb = new ProcessBuilder("/path/to/java", "-jar", "your.jar", "thetextfile.txt"); pb.directory(new File("preferred/working/directory")); Process p = pb.start();
ps: do a pen to kill the process, otherwise it will consume all the memory
source share