0ddd1c3bc9f8af0ff3bffe88e9bb0d57bf5566b5
[jpf-core.git] / doc / devel / embedded.md
1 # Embedded JPF #
2 JPF can also be used embedded, i.e. called from another Java application. A basic code sequence to start JPF looks like this:
3
4 ~~~~~~~~ {.java}
5 import gov.nasa.jpf.JPF;
6 import gov.nasa.jpf.Config;
7
8 void runJPF (String[] args) {
9    ..
10    MyListener listener = new MyListener(..);
11
12    // [optionally] if you pass through command line args, 
13    // 'null' any consumed args not to be JPF-processed
14    listener.filterArgs( args);
15    ..
16
17    Config config = JPF.createConfig( args);
18    // set special config key/value pairs here..
19
20    JPF jpf = new JPF( config);
21    jpf.addListener( listener);
22    jpf.run();
23    ..
24 }
25 ~~~~~~~~
26
27 Of course, you can also call `gov.nasa.jpf.JPF.main(args)` from within your application, if you don't need to control JPF's configuration or process it's output.