Archive

Archive for the ‘JAVA JIF’ Category

Decentralized Label Model and JIF Java Information Flow

March 3, 2010 Leave a comment

find a presentation on Decentralized Label Model and JIF Java Information Flow

http://www.scribd.com/doc/27753082

Categories: JAVA JIF

Compile and Run JIF Programs Using JIF Compiler

February 23, 2010 2 comments

First Build JIF Compiler using Apache ant, find all steps here:
JIF (Java Information Flow) Compiler Building Using Ant in ubuntu and windows

Compile and Run JIF Programs steps:

  1. After building JIF compiler, we can try this compiler by executing a sample demo program available in $jif/examples i.e. battleship. To compile and run the battleship example follow the below steps;
  2. Ensure that the principals Alice and Bob are present. The code for the principals is in the $JIF/tests directory. To compile the code for the principals, perform the following commands.
    mohsin@mohsin-laptop:~/jif-3.3.1/tests$  jifc /home/mohsin/jif-3.3.1/tests/jif/principals/Alice.jif /home/mohsin/jif-3.3.1/tests/jif/principals/Bob.jif
  3. Also add the path in CLASSPATH environmental variable like below;
    export CLASSPATH=$CLASSPATH:$JIF/test/
  4. Compile the BattleShip classes, perform the following command.
    mohsin@mohsin-laptop:~/jif-3.3.1/examples/battleship$ jifc -classpath $JIF/tests *.jif
  5. Execute the BattleShip Example by running the following command.
    mohsin@mohsin-laptop:~/jif-3.3.1/examples/battleship$ jif -classpath $JIF/tests Main
  6. Output:
    Playing battleships, with each player having 10 covered coordinates

Initializing…. Done.
Playing rounds…
Alice: (0, 0)?  N   Bob: (0, 0)?  N   Score: 0 vs. 0
Alice: (1, 0)?  N   Bob: (1, 0)?  N   Score: 0 vs. 0
Alice: (0, 1)?  N   Bob: (0, 1)?  N   Score: 0 vs. 0
Alice: (0, 2)?  N   Bob: (0, 2)?  N   Score: 0 vs. 0
Alice: (1, 1)?  Y   Bob: (1, 1)?  Y   Score: 1 vs. 1
Alice: (2, 0)?  N   Bob: (2, 0)?  N   Score: 1 vs. 1
Alice: (3, 0)?  N   Bob: (3, 0)?  N   Score: 1 vs. 1
Alice: (2, 1)?  N   Bob: (2, 1)?  N   Score: 1 vs. 1
Alice: (1, 2)?  N   Bob: (1, 2)?  N   Score: 1 vs. 1
Alice: (0, 3)?  N   Bob: (0, 3)?  N   Score: 1 vs. 1
Alice: (0, 4)?  N   Bob: (0, 4)?  N   Score: 1 vs. 1
Alice: (1, 3)?  Y   Bob: (1, 3)?  Y   Score: 2 vs. 2
Alice: (2, 2)?  Y   Bob: (2, 2)?  Y   Score: 3 vs. 3
Alice: (3, 1)?  N   Bob: (3, 1)?  N   Score: 3 vs. 3
Alice: (4, 0)?  N   Bob: (4, 0)?  N   Score: 3 vs. 3
Alice: (5, 0)?  N   Bob: (5, 0)?  N   Score: 3 vs. 3
Alice: (4, 1)?  N   Bob: (4, 1)?  N   Score: 3 vs. 3
Alice: (3, 2)?  Y   Bob: (3, 2)?  Y   Score: 4 vs. 4
Alice: (2, 3)?  N   Bob: (2, 3)?  N   Score: 4 vs. 4
Alice: (1, 4)?  Y   Bob: (1, 4)?  Y   Score: 5 vs. 5
Alice: (0, 5)?  N   Bob: (0, 5)?  N   Score: 5 vs. 5
Alice: (0, 6)?  N   Bob: (0, 6)?  N   Score: 5 vs. 5
Alice: (1, 5)?  N   Bob: (1, 5)?  N   Score: 5 vs. 5
Alice: (2, 4)?  N   Bob: (2, 4)?  N   Score: 5 vs. 5
Alice: (3, 3)?  N   Bob: (3, 3)?  N   Score: 5 vs. 5
Alice: (4, 2)?  Y   Bob: (4, 2)?  Y   Score: 6 vs. 6
Alice: (5, 1)?  N   Bob: (5, 1)?  N   Score: 6 vs. 6
Alice: (6, 0)?  N   Bob: (6, 0)?  N   Score: 6 vs. 6
Alice: (7, 0)?  N   Bob: (7, 0)?  N   Score: 6 vs. 6
Alice: (6, 1)?  N   Bob: (6, 1)?  N   Score: 6 vs. 6
Alice: (5, 2)?  N   Bob: (5, 2)?  N   Score: 6 vs. 6
Alice: (4, 3)?  N   Bob: (4, 3)?  N   Score: 6 vs. 6
Alice: (3, 4)?  Y   Bob: (3, 4)?  Y   Score: 7 vs. 7
Alice: (2, 5)?  N   Bob: (2, 5)?  N   Score: 7 vs. 7
Alice: (1, 6)?  N   Bob: (1, 6)?  N   Score: 7 vs. 7
Alice: (0, 7)?  N   Bob: (0, 7)?  N   Score: 7 vs. 7
Alice: (0, 8)?  N   Bob: (0, 8)?  N   Score: 7 vs. 7
Alice: (1, 7)?  N   Bob: (1, 7)?  N   Score: 7 vs. 7
Alice: (2, 6)?  N   Bob: (2, 6)?  N   Score: 7 vs. 7
Alice: (3, 5)?  Y   Bob: (3, 5)?  Y   Score: 8 vs. 8
Alice: (4, 4)?  N   Bob: (4, 4)?  N   Score: 8 vs. 8
Alice: (5, 3)?  N   Bob: (5, 3)?  N   Score: 8 vs. 8
Alice: (6, 2)?  N   Bob: (6, 2)?  N   Score: 8 vs. 8
Alice: (7, 1)?  N   Bob: (7, 1)?  N   Score: 8 vs. 8
Alice: (8, 0)?  N   Bob: (8, 0)?  N   Score: 8 vs. 8
Alice: (9, 0)?  N   Bob: (9, 0)?  N   Score: 8 vs. 8
Alice: (8, 1)?  N   Bob: (8, 1)?  N   Score: 8 vs. 8
Alice: (7, 2)?  N   Bob: (7, 2)?  N   Score: 8 vs. 8
Alice: (6, 3)?  N   Bob: (6, 3)?  N   Score: 8 vs. 8
Alice: (5, 4)?  N   Bob: (5, 4)?  N   Score: 8 vs. 8
Alice: (4, 5)?  N   Bob: (4, 5)?  N   Score: 8 vs. 8
Alice: (3, 6)?  Y   Bob: (3, 6)?  Y   Score: 9 vs. 9
Alice: (2, 7)?  N   Bob: (2, 7)?  N   Score: 9 vs. 9
Alice: (1, 8)?  N   Bob: (1, 8)?  N   Score: 9 vs. 9
Alice: (0, 9)?  N   Bob: (0, 9)?  N   Score: 9 vs. 9
Alice: (0, 10)?  N   Bob: (0, 10)?  N   Score: 9 vs. 9
Alice: (1, 9)?  N   Bob: (1, 9)?  N   Score: 9 vs. 9
Alice: (2, 8)?  N   Bob: (2, 8)?  N   Score: 9 vs. 9
Alice: (3, 7)?  Y
Alice won!

Categories: JAVA JIF

JIF (Java Information Flow) Compiler Building Using Ant in ubuntu and windows

February 23, 2010 3 comments

JIF Compiler Building Using Ant in ubuntu and windows:

JIF Compiler Building

  1. Ubuntu
  2. Windows

a. Ubuntu

I.            Download the JIF compiler from http://www.cs.cornell.edu/jif/

II.            Save in ur folder, in my case /home/mohsin/jif-3.3.1/

III.          Use the command $sudo unzip /home/mohsin/jif-3.3.1

IV.          Set the path of JIF Environment Variable using this command $export JIF=/home/mohsin/jif-3.3.1

V.            Now install Apache Ant, java-6-sun-1.6, g++ using command sudo sudo apt-get install Package_Name

VI.          After installing above programming software, set the following environment using following command

  1. export JIF=/home/mohsin/jif-3.3.1
  2. export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.15/
  3. export ANT_HOME=/usr/bin/ant
  4. export CLASSPATH=.
  5. export PATH=$JAVA_HOME:$PATH: $JIF/bin
  6. export CLASSPATH=$CLASSPATH:$JIF/test/

VII.            Run $ ant configure; This ensures that the classpath is set appropriately, and creates the executable scripts $JIF/bin/jifc and $JIF/bin/jif.
VIII.         Run $ ant jif-runtime; This compiles the $JIF/rt-src directory. Some of the code in this directory is C++ code, and the compilation of this code is platform-specific. Jif requires the C++ compiler g++ to be available to compile this code.
IX.             Run $ ant; This compiles the $JIF/src, $JIF/sig-src and $JIF/lib-src directories. The resulting .class files for the source code in $JIF/src, $JIF/sig-src and $JIF/lib-src will be stored in $JIF/classes, $JIF/sig-classes and $JIF/lib-classes respectively.
X.              You are now ready to try out Jif

b. Windows

All the above steps are same; just for native lib execution by c++ compiler. We use Cygwin.

Categories: JAVA JIF