User Tools

Site Tools


java_class_process

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
java_class_process [2013/04/29 08:32]
yann
java_class_process [2017/09/06 01:54] (current)
Line 42: Line 42:
 ====== 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 managed ​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:
  
 <​code>​ <​code>​
Line 50: Line 50:
 </​code>​ </​code>​
  
-With these changes, the same input file and the same instrumented bytecodes would produced ​the same, expected traces in both Windows and MacOS computers! Soumaya and Venera could not continue their research ​work 8-). However, these changes were not satisfying because they did not explain why...+With these changes, the same input file and the same instrumented bytecodes would produce ​the same, expected traces in both Windows and MacOS computers! Soumaya and Venera could now continue their research ​works 8-). However, these changes were not satisfying because they did not explain why...
  
-So, after some more tinkering, it follows ​that it is not ProcessBuilder that saved the day but the implementations of the Runtime.exec() methods that have different behaviour on Windows and MacOS. The class Runtime provides several exec() methods to create new processes but two are of particular interest here:+So, after some more tinkering, it appeared ​that it is **not** ProcessBuilder that saved the day but the implementations of the Runtime.exec() methods that have different behaviour on Windows and MacOS. The class Runtime provides several exec() methods to create new processes but two are of particular interest here:
   - Runtime.exec(String command, String[] envp, File dir): "​Executes the specified string command in a separate process with the specified environment and working directory."​   - Runtime.exec(String command, String[] envp, File dir): "​Executes the specified string command in a separate process with the specified environment and working directory."​
   - Runtime.exec(String[] command, String[] envp, File dir): "​Executes the specified command **and arguments** in a separate process with the specified environment and working directory."​ (bold added).   - Runtime.exec(String[] command, String[] envp, File dir): "​Executes the specified command **and arguments** in a separate process with the specified environment and working directory."​ (bold added).
  
-In previous versions of [[MoDeC]], we use the first method, in the case of ArgoUML, which the following command:+In previous versions of [[MoDeC]], we used the first method, e.g., in the case of ArgoUML ​with the following command:
  
 <​code>​ <​code>​
-String command = "java -classpath "/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeC Invoker/​bin:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​pdf-transcoder.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-anim.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-bridge.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-codec.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-extension.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-gui-util.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-gvt.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-script.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-swing.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-transcoder.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-parser.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-css.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-svg-dom.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-ext.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​commons-lang-2.4.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​bin:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​tools.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​xalan-2.6.0.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​xerces_2_5_0.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​xml-apis.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​xml-apis-ext.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​cfparse:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​bcel:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-awt-util.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-dom.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-svggen.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-util.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-xml.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​trove-3.0.0a3.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCMetamodel/​bin:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeC Bytecode Instrumentation/​bin:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeC Bytecode Instrumentation Tests/​bin:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​InstrumentedClasses/​ArgoUMLv0.19.8:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​antlrall-2.7.2.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​commons-logging-1.0.2.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​gef-0.11.2.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​jmi-1.0.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​jmi.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​jmiuml-1.4di.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​jmiutils.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​log4j-1.2.6.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​mdr.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​mof.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​nsuml-0.4.20_modified.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​ocl-argo-1.1.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​org-netbeans-api-mdr.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​org-netbeans-jmi-javamodel.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​org-openide-util.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​swidgets-0.1.1.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​toolbar-1.1.0.jar"​ org.argouml.application.Main"​+final String command = "java -classpath "/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeC Invoker/​bin:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​pdf-transcoder.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-anim.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-bridge.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-codec.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-extension.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-gui-util.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-gvt.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-script.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-swing.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-transcoder.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-parser.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-css.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-svg-dom.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-ext.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​commons-lang-2.4.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​bin:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​tools.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​xalan-2.6.0.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​xerces_2_5_0.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​xml-apis.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​xml-apis-ext.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​cfparse:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​bcel:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-awt-util.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-dom.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-svggen.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-util.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​batik-xml.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​CPL/​lib/​trove-3.0.0a3.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCMetamodel/​bin:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeC Bytecode Instrumentation/​bin:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeC Bytecode Instrumentation Tests/​bin:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​InstrumentedClasses/​ArgoUMLv0.19.8:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​antlrall-2.7.2.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​commons-logging-1.0.2.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​gef-0.11.2.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​jmi-1.0.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​jmi.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​jmiuml-1.4di.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​jmiutils.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​log4j-1.2.6.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​mdr.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​mof.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​nsuml-0.4.20_modified.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​ocl-argo-1.1.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​org-netbeans-api-mdr.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​org-netbeans-jmi-javamodel.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​org-openide-util.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​swidgets-0.1.1.jar:/​Users/​Neni/​Documents/​Research/​2013-LabalingTraceSegm/​eclipseWS/​MoDeCBytecodeInstrumentationTests/​ArgoUMLv0.19.8/​lib/​toolbar-1.1.0.jar"​ org.argouml.application.Main"​
 </​code>​ </​code>​
  
-which worked fine on Windows **but not** on MacOS. In new versions of [[MoDeC]], independently of the use of ProcessBuilder,​ we (could) use the second methodand it would work similarly on both Windows and MacOS, with the same following command:+which worked fine on Windows **but not** on MacOS. In new versions of [[MoDeC]], independently of the use of ProcessBuilder,​ we (could) use the second method and it would work similarly on both Windows and MacOS, with the same following command:
  
 <​code>​ <​code>​
java_class_process.1367224370.txt.gz ยท Last modified: 2017/09/06 01:54 (external edit)