In this post we shall investigate how to obtain and install the jpf source code.
In order to obtain the jpf source code we must follow the steps listed below:-
sudo apt-get install mercurial
On other operating systems, you have to follow the general installation procedure that is used in your systems after obtaining the software from mercurial’s website.
In the following steps, you will be using mercurial to obtain and install the jpf source code. You may want to read the tutorial on how to use mercurial, here, before we proceed.
hg clone
As the name suggests, we are actually cloning the complete folder as it is on the repository online. You will definitely need the jpf-core component and it is also sufficient to have this module to get started. As suggested on the jpf web site, I created a default folder called ‘projects’ and cloned the jpf-core component inside this folder. Thus the commands that I entered, were as follows,
$mkdir projects $cd projects $hg clone http://babelfish.arc.nasa.gov/trac/jpf/wiki/projects/jpf-core jpf-core
$cd jpf-core $hg verify
If you get an output similar to what is given below, without any error reported, then the clone was successful, else there was some problem while downloading and you may have to clone the repository again.
checking changesets checking manifests crosschecking files in changesets and manifests checking files 1727 files, 157 changesets, 2369 total revisions abdullah@abdullah-desktop:~/projects/jpf-core$
Upon successful completion of the above three steps, we would have obtained a copy of the jpf-core component. In order to obtain the source code of other components we have to follow the same above procedure but change the site name appropriately while cloning (step 2).
Now, that we have the source code for a particular component, in order to build the source code and create the executables, all we have to do is enter the following command,
$cd ~/projects/jpf-core $bin/ant test
The above code will create all executables in the appropriate sub folders of the source directory.
Lastly, in order to configure the jpf-core component we need to create and update a site.properties file. In order to do that, type in the following commands,
$cd $HOME $mkdir .jpf $gedit site.properties
The text editor will open up and you have to enter the following
jpf-core=~/projects/jpf-core
The above line indicates the location of the source code for the jpf-core folder in your system. So, make appropriate changes to the location address if needed.
To run jpf on a sample program check the previous post, the only change that has to be made is that, instead of,
$~/binaries/jpf-core/bin/jpf +classpath=. Rand
we have to type in the following,
$~/projects/jpf-core/bin/jpf +classpath=. Rand