0% found this document useful (0 votes)
23 views

JavaMOP Tutorial

In this tutorial, we shall use JavaMOP to specify monitor specifications and weave their implementation into the target code.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

JavaMOP Tutorial

In this tutorial, we shall use JavaMOP to specify monitor specifications and weave their implementation into the target code.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

JavaMOP Tutorial

Friday, March 29, 2019 2:13 PM

In this tutorial, we shall use JavaMOP to specify monitor specifications and weave their implementation
into the target code.

JavaMOP requires JDK, AJC and RV-Monitor.

1. JDK v.7 or higher


2. AJC v.1.8 or higher
• Check AspectJ is installed properly: run ajc -version from a terminal.
• Add <AspectJ_HOME>/lib/aspectjrt.jar, <AspectJ_HOME>/lib/aspectjweaver.jar and<AspectJ_HO
ME>/lib/aspectjtools.jar to your CLASSPATH.
3. RV-Monitor v.1.3 or higher
• Check RV-Monitor is installed properly: run rv-monitor -version from a terminal.
• Add <RV-Monitor_HOME>/lib/rv-monitor.jar and <RV-Monitor_HOME>/lib/rv-monitor-rt.jar to
your CLASSPATH.

Download javamop 4.2 from http://fsl.cs.illinois.edu/index.php/JavaMOP4.

Add %RV-Monitor_HOME%/lib/rv-monitor.jar;%RV-Monitor_HOME%/lib/rv-monitor-rt.jar;%RV-
Monitor_HOME%\bin; to SystemVariables.Path

Source files are available in the examples directory: C:\javamop-4.2\javamop\examples\ERE. If you


installed JavaMOP in a different folder other than C:\javamop-4.2, use the appropriate path here.

Now, we specify properties in .mop file. Further, we use JavaMOP to synthesize specification as .aj files.
We use AspectJ to weave them into Java code. Run the target file to see the results.

c:\code\aspectj\sf>javamop SafeFileWriter.mop
-Processing SafeFileWriter.mop
SafeFileWriter.rvm is generated
SafeFileWriterMonitorAspect.aj is generated
-Processing SafeFileWriter.rvm
SafeFileWriterRuntimeMonitor.java is generated

c:\code\aspectj\sf>ajc -1.8 -d . SafeFileWriter_1.java *.aj

c:\code\aspectj\sf>java -cp c:\RV-Monitor\lib\rv-monitor-rt.jar;c:\RV-Monitor\lib\rv-monitor.jar;c:


\aspectj1.9\lib\aspectjrt.jar;. SafeFileWriter_1
1:3
2:2
3:2
4:2
5:3
write after close
write after close
write after close

Program Analysis Page 1

You might also like