beanshell简单使用

 package com.beanshell;

import java.io.FileNotFoundException;
import java.io.IOException;

import bsh.EvalError;
import bsh.Interpreter;

public class TestShell {

 /**
  * @param args
  * @throws EvalError
  * @throws IOException
  * @throws FileNotFoundException
  */
 public static void main(String[] args) throws FileNotFoundException, IOException, EvalError {
  // TODO Auto-generated method stub

  Interpreter bsh = new Interpreter();
  bsh.source("src/com/beanshell/test.bsh");
 }

}

 

test.bsh:

 

f = 2*2;
print("==========f="+f);

 

你可能感兴趣的:(beanshell简单使用)