User Tools

Site Tools


java_class_process

This is an old revision of the document!


Between 1.4.2 and the versions v1.6+ of the JDK, changes have been made to the creation of processes. These changes bring benefits, in particular in the light of a nasty bug found by Soumaya and Venera when running MoDeC on MacOS.

Java Class Process

The Java class Process is used together with class Runtime. As explained by Oracle: “The Runtime.exec methods create a native process and return an instance of a subclass of Process that can be used to control the process and obtain information about it. The class Process provides methods for performing input from the process, performing output to the process, waiting for the process to complete, checking the exit status of the process, and destroying (killing) the process.” (from the Javadocs of version 1.4.2).

Typically, in MoDeC, we created and run a Process that executes a new Java virtual machine, which itself runs a program whose bytecodes we had instrumented to collect traces. Simply put:

String commandLine = ...;
String absolutePathToInstrumentedFiles = ...;

final Process process =
	Runtime.getRuntime().exec(
		commandLine,
		new String[0],
		absolutePathToInstrumentedFiles);

where

  • commandLine is the complete command line to run a new Java virtual machine;
  • new string[0] tells the Runime.exec() that we do not touch the environment;
  • absolutePathToInstrumentedFiles is the complete, absolute path to the root directory containing the instrumented bytecodes.

The Bug

The Solution

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!

java_class_process.1367222500.txt.gz · Last modified: 2019/10/06 20:37 (external edit)