블로그 이미지
윤영식
Full Stacker, Application Architecter, KnowHow Dispenser and Bike Rider

Publication

Category

Recent Post

2012. 10. 26. 14:53 Languages/Java

BeanShell은 java syntax로 짠 script의 랭귀지 인터프리터이다. 

사이트 : http://www.beanshell.org 


▶ BeanShell 설치


  - 먼저 bsh-xxx.jar 파일을 다운로드 받는다

  - 윈도우라면 classpath 경로에 추가한다  

       


  - BeanShell은 GUI 또는 Command Line에서 수행할 수 있다

   + java bsh.Console : GUI

      


    + java bsh.Interpreter : text only command line

     


    + java bsh.Interpreter filename [args] : run script file


  - BeanShell은 일반 java appliction에서 호출 할 수도 있다 (application에서 bsh.Interpreter를 new 해서 호출)

  - BeanShell GUI 에서 loose type 으로 자바 코딩하듯이 짜면 된다. ( print()는 System.out.println()의 bsh 내장 함수)

    


  - 좀 더 자세한 사용자 메뉴얼 : http://www.beanshell.org/manual/bshmanual.htm 참조

  - default import 구문

    + javax.swing.event

    + javax.swing

    + java.awt.event

    + java.awt

    + java.net

    + java.util

    + java.io

    + java.lang


  - BeanShell 동작 방식

    + standalone 모드 : java bsh.Interpreter [filename] [arg..]

     

    + remote 모드 : java bsh.Remote [HTTP 또는 bsh URL] 

   



▶ BeanShell 을 Remote Server에서 접속하여 사용하기 

  - Remote Server Mode 흐름도 : 웹브라우져에서 접속하거나, Telnet 접속이 가능하다. 또는 Servlet 코드에서 접속도 가능하다

   


  - 웹브라우져 접속방법

    + 내 BeanShell이 있는 곳에서 내장함수 server(portNum); 수행

      

    

    + 불여우(FireFox)에서 http://<주소>:<portNum>/remote/jconsole.html 로 접속한다 (주의 : 브라우져에서 여러개 bsh console을 열어서 작업을 할 수 있으나 global session이어서 서로 share된다)

     


  - telnet 접속 : telnet <myhost> <port+1>  여기서는 "telnet localhost 8082"
    


  - 그외 BshServlet을 통한 호출도 가능 하다. 

  

▶ BeanShell 사용하는 곳


  - JMeter에서 BeanShell 적용하기 : http://nezah.egloos.com/4336838

  - Eclispe에 BeanShell적용하기 : http://blog.sangpire.pe.kr/69

  - 기타 기초적인 것은 구글링~~~ (구글 이자식들 독도명 지도에서 삭제해가지고 열받는 중. SW 주권을 찾을 때다)


posted by 윤영식