This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
java_class_process [2013/04/29 08:32] yann |
java_class_process [2013/04/29 08:32] yann |
||
---|---|---|---|
Line 23: | Line 23: | ||
* absolutePathToInstrumentedFiles is a File pointing on the root directory containing the instrumented bytecodes. | * absolutePathToInstrumentedFiles is a File pointing on the root directory containing the instrumented bytecodes. | ||
- | ===== The Bug ===== | + | ====== The Bug ====== |
When applying [[MoDeC]] on "small" programs, we did not encounter any problem, neither on Windows nor on MacOS. However, when Soumaya ran [[MoDeC]] on the instrumented version of ArgoUML v0.19.8, she got this exception (here reproduced using Venera's Mac): | When applying [[MoDeC]] on "small" programs, we did not encounter any problem, neither on Windows nor on MacOS. However, when Soumaya ran [[MoDeC]] on the instrumented version of ArgoUML v0.19.8, she got this exception (here reproduced using Venera's Mac): | ||
Line 40: | Line 40: | ||
which was very puzzling, because the //same// version of [[MoDeC]] and the //same// input file and the //same// instrumented bytecodes would work on Yann's Windows laptop and produce the expected traces. | which was very puzzling, because the //same// version of [[MoDeC]] and the //same// input file and the //same// instrumented bytecodes would work on Yann's Windows laptop and produce the expected traces. | ||
- | ===== The Solution ===== | + | ====== The Solution ====== |
After much tinkering, we decided manage to get [[MoDeC]] to work by using the "new" class ProcessBuilder because "As of 1.5, ProcessBuilder.start() is the preferred way to create a Process." (according to [[http://docs.oracle.com/javase/7/docs/api/java/lang/Process.html|Oracle]] in a version of the Javadocs subsequent to 1.5). We modified essentially the code as follows: | After much tinkering, we decided manage to get [[MoDeC]] to work by using the "new" class ProcessBuilder because "As of 1.5, ProcessBuilder.start() is the preferred way to create a Process." (according to [[http://docs.oracle.com/javase/7/docs/api/java/lang/Process.html|Oracle]] in a version of the Javadocs subsequent to 1.5). We modified essentially the code as follows: | ||
Line 70: | Line 70: | ||
So, the difference is //simply// the use of the Runtime.exec(String, String[], File) on Windows, broken on MacOS, and the use of the Runtime.exec(String[], String[], File), which behaves as expected on both Windows and MacOS! 8-O The conclusion is: break down any command line in an array of its components (command, argument 1, ..., argument N) and the Runtime.exec(String[]) method takes care of the rest for you. | So, the difference is //simply// the use of the Runtime.exec(String, String[], File) on Windows, broken on MacOS, and the use of the Runtime.exec(String[], String[], File), which behaves as expected on both Windows and MacOS! 8-O The conclusion is: break down any command line in an array of its components (command, argument 1, ..., argument N) and the Runtime.exec(String[]) method takes care of the rest for you. | ||
- | ===== Acknowledgements ===== | + | ====== Acknowledgements ====== |
This bug could not have been found without the dedicated MacOS users of the lab. Soumaya and Venera ;-). This bug could not have been fixed without Venera's great help and patience! | This bug could not have been found without the dedicated MacOS users of the lab. Soumaya and Venera ;-). This bug could not have been fixed without Venera's great help and patience! |