We launch a Wscript process (wscript is like sh/ksh/bash shell on windows) from
Runtime.exec(). This wscript is suppose to call a program (non-gui) which will
delete some of the jre files and install the new ones. The wscript does wait for
the JVM process to exit before trying to delete any of its files.
The problem is the child process created from Runtime.exec() opens some font
files from JRE/lib/fonts (LucidaSansRegular.ttf) for NO reason. The wscript
spawned doesn't require it or doesn't request it either. Since this font file is
open and belongs to the jre, the script is unable to delete the file and
reinstall the new one.
The wscript when run by itself from the command prompt doesn't open any font
files. Its just when the wscript is launched from Runtime.exec() that the font
file is opened.
Attached is a sample testcase to reproduce the problem. It has the following files:
1. Test.class - this brings up a frame with two buttons - "Launch WScript"
and "Close". When you click on "Launch Wscript", it launches test.js
2. test.js - this sleeps for 10 seconds and then brings up an alert that it
will be closing.
3. Handle.exe, a utility to see the file handles being used by these
executables.
To run the test:
1. Launch Test.class using JRE 1.4.0_01 : "java Test.class"
2. Use handle.exe to see that all the font files are being loaded by
"java.exe"
3. Then click on "Launch Wscript". This will launch test.js
4. Again use handle to see that all the font files are also being loaded by
"wscript.exe"
5. Click "OK" on the alert box of the script.
6. Click "close" to end the test.
You can also just run the wscript interpreter and handle.exe to the that the
font file is not open normally.