Warning:
The parser JML works perfectly on a code source
compilable under java 1.4.2. This does not mean that you need to have
JSDK 1.4.2 but just that you need to respect the syntax defined in the
API 1.4.2 and not use any specific constructs (like generics)
introduced in newer version of java (1.5, 1.6, ..). One easy way of
ensuring it on Eclipse is to change the java compiler compliance level
(your project -> properties -> Java Compiler) and select
1.4.
JML Eclipse plugin made at the Swiss Federal institute of Technology Zurich :
http://pm.inf.ethz.ch/research/universes/tools/eclipse/
Note:
For some strange reason, we did not manage to install this Eclipse
plugin at our student Chalmers accounts. We are still investigating
how this could be resolved. (If you have a hint, please tell us.)
Easy install and usage:
In the eclipse menu:
- Help->Software Updates->Find and Install
- Search for new features to install
- New Remote Site :
NAME : JML2 (can be whatever you like)
URL : http://www.pm.inf.ethz.ch/research/universes/tools/eclipse/
Then click OK and Finish
- in the new popup window titled Updates, tick JML box then click Next
- accept the License, click Next and then Finish
- choose Install All in the new window then Yes -> Eclipse should restart !
Now you will see that three new buttons have appeared in the tool bar :
- checker (parser)
- compiler
- exec
Also, to Automatically check (parse) your JML-specified files:
- save your files:
- right click on the project -> properties -> JML2 Plug-in -> tick the automatically run JML2 checker box
JML 5.5 from sourceforge.net (Command Line and Graphical User Interface (GUI))
http://sourceforge.net/project/showfiles.php?group_id=65346&package_id=62764&release_id=567453
- download JML.5.5.tar.gz
- extract it
Then go for one of the followings:
ON WINDOWS XP
If you dont have java installed at all on your machine, download JSDK 1.4.2 and install it.
- set the PATH environment variable:
:right click on my computer -> properties -> advanced tab -> Environment Variables -> User Variables -> Edit PATH (if you have it already, otherwise click on New and define a new variable named PATH) -> add, as value, your JML directory (e.g. If you have installed it under c:\JML, then add c:\JML\bin to the PATH)
- edit jmlenv.bat (in your JML directory) and change the variable JMLDIR to your installed JML directory
- run command line (cmd) -> jml file1.java file2.jml or jml . (to parse all the files in the current directory)
You can also use a GUI which is located in the JML directory under the name jml-gui.bat :
- run command line -> jml-gui.bat -> open file -> select your file -> choose Run from the menu or press the play button
For more info go to the README.html (in the JML directory)
ON YOUR OWN LINUX
If you dont have java installed at all on your machine, download JSDK 1.4.2 and install it.
Open the file named Install-JML-Scripts under bin directory of JML directory:
- modify INSTALLDIR
: ${INSTALLDIR="/usr/local"} # installation target directory
and instead of /usr/local, put the path where you extracted your JML tar file (e.g. in our system, we extracted JML on our desktop, so we changed it to:
: ${INSTALLDIR="/home/cyrilj/Desktop"} # installation target directory
- modify JDKTOOLS
: ${JDKTOOLS="/usr/local/jdk1.4/lib/tools.jar"}
and instead of /usr/local/jdk1.4/lib/tools.jar, put where you have tools.jar:
: ${JDKTOOLS="/usr/lib/jvm/java-1.4.2/lib/tools.jar"} (see Notes)
- run ./Install-JML-Scripts from the bin directory in JML directory.
- once it is done, two directories have been created on your INSTALLDIR named bin and man.
- in the bin directory:
: run ./jml to use the checker
: run ./jml-gui to launch the GUI
CHALMERS RED HAT (Student Account)
Open the file named Install-JML-Scripts under bin directory of JML directory:
- modify INSTALLDIR
: ${INSTALLDIR="/usr/local"} # installation target directory
and instead of /usr/local, put the path where you have extracted your JML tar file (e.g. in our system, we extracted JML on our desktop, so we changed it to:
: ${INSTALLDIR="/chalmers/users/cyrilj/Desktop"} # installation target directory
- modify JDKTOOLS
: ${JDKTOOLS="/usr/local/jdk1.4/lib/tools.jar"}
and instead of /usr/local/jdk1.4/lib/tools.jar, put:
: ${JDKTOOLS="/usr/lib/jvm/java-1.4.2/lib/tools.jar"}
- run ./Install-JML-Scripts from the bin directory in JML directory.
- once it is done, two directories have been created on your INSTALLDIR named bin and man.
- in the bin directory:
: run ./jml to use the checker
: run ./jml-gui to launch the GUI
Notes:
In case you get an error concerning J2SDK when running Install-JML-Scripts, simply open the file, go to the line that says exit 1 (line 45) and comment it by putting a # before it! Save it and re-run the script.
So far we have seen, we don't really need any tools.jar to run the JML parser. By commenting the "exit 1" statement, you will bypass the checking of the presence of that jar.