tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Java Scripting > BeanShell > Source File Info Command

Source File Info Command 

BeanShell is a small, free, embeddable Java source interpreter with object scripting language features, written in Java. BeanShell is a natural scripting language for Java. This requires the library bsh-2.0b4.jar to be in classpath. The following example shows using getSourceFileInfo command in beanshell script.

File Name  :  
/BEAN_SHELL001/config/source_info.bsh 
   
print("This script is loaded from : " + getSourceFileInfo())
   

File Name  :  
com/bethecoder/tutorials/bean_shell/commands/SourceFileInfoTest.java 
Author  :  Sudhakar KV
Email  :  [email protected]
   
package com.bethecoder.tutorials.bean_shell.commands;

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

import bsh.EvalError;
import bsh.Interpreter;

public class SourceFileInfoTest {

  /**
   @param args
   @throws EvalError 
   @throws IOException 
   @throws FileNotFoundException 
   */
  public static void main(String[] argsthrows EvalError, 
    FileNotFoundException, IOException {
    
    Interpreter interpreter = new Interpreter();  
    interpreter.source("C:/Temp/source_info.bsh");
  }

}
   

It gives the following output,
This script is loaded from : C:/Temp/source_info.bsh



 
  


  
bl  br