I'm new to writing Windows batch file. I have the following batch file to start a new javaw process and redirect the output of the commands in the batch file to a log file.
@echo OFF
call :sub >start-demo.jar.cmd.log
exit /b
:sub
echo starting demo.jar ..
start "" javaw -jar demo.jar
echo done ..
It's working fine and I can see that the output is redirected correctly to the log file and the javaw process is also started with a new process id when I execute the batch file.
Here is the output redirected to the log file after the batch file is executed.
starting demo.jar ..
done ..
However, when I try to edit or delete the log file after the batch file is executed, it says that the action can't be completed because the file is open in Java(TM) Platform SE binary.
Only after killing the javaw process I'm able to edit or delete the log file.
Not sure why this is happening and how to fix this. My expectation is that once the javaw process is started successfully, I should be able to edit or delete the log file. Is this correct?
My OS is Windows 10 Enterprise 64 bit.