How to change content of batch file using Java code?
I worked with parsing XML using Java program. It worked fine. But can I do same for the batch file using Java?
I am able to run batch file using below code.
String command = "cmd /c start " + batFile;
Runtime rt = Runtime.getRuntime();
rt.exec(command);
The content of my batch file is:
@echo off
cd C:\Program Files (x86)\SourceMonitor
start SourceMonitor.exe /C "C:\shravani-workspace\appanalytix\src\main\resources\appanalysis.xml"
exit
But before doing this I want to change location
C:\shravani-workspace\appanalytix\src\main\resources\appanalysis.xml
..to user given XML location. How can I achieve this in my Java application?