File: callFromJava.java

package info (click to toggle)
bsh 1.1alpha5-1
  • links: PTS
  • area: contrib
  • in suites: woody
  • size: 2,336 kB
  • ctags: 2,083
  • sloc: java: 16,095; makefile: 134; sh: 51
file content (18 lines) | stat: -rw-r--r-- 400 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import bsh.*;

public class callFromJava { 

	public static void main( String argv[] ) throws EvalError {

		Interpreter interpreter = new Interpreter();
		interpreter.setVariable("foo", 5);
		interpreter.eval("bar = foo*10");
		Integer bar = (Integer)interpreter.getVariable("bar");

		if ( bar.intValue() != 50 )
			System.out.println("FAILED...");
		else
			System.out.println("passed...");
	}
}