summaryrefslogtreecommitdiffstats
path: root/src/test/java/com/kitfox/salamander/javascript/JSTest.java
blob: 4651298738d61bcc58409c252752b50c4f4f658d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
 * JSTest.java
 *
 * Created on April 16, 2007, 12:59 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.kitfox.salamander.javascript;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;

/**
 * http://java.sun.com/developer/technicalArticles/J2SE/Desktop/scripting/
 *
 * @author kitfox
 */
public class JSTest
{
    
    /** Creates a new instance of JSTest */
    public JSTest()
    {
          ScriptEngineManager mgr = new ScriptEngineManager();
          ScriptEngine jsEngine = mgr.getEngineByName("JavaScript");
          try {
            jsEngine.eval("print('Hello, world!')");
          } catch (ScriptException ex) {
              ex.printStackTrace();
          }   
    }

    public static void main(String[] args)
    {
        new JSTest();
    }
}