Using Java Objects in JavaScript : Script Engines « Development « Java Tutorial

Java Tutorial
1. Language
2. Data Type
3. Operators
4. Statement Control
5. Class Definition
6. Development
7. Reflection
8. Regular Expressions
9. Collections
10. Thread
11. File
12. Generics
13. I18N
14. Swing
15. Swing Event
16. 2D Graphics
17. SWT
18. SWT 2D Graphics
19. Network
20. Database
21. Hibernate
22. JPA
23. JSP
24. JSTL
25. Servlet
26. Web Services SOA
27. EJB3
28. Spring
29. PDF
30. Email
31. J2ME
32. J2EE Application
33. XML
34. Design Pattern
35. Log
36. Security
37. Apache Common
38. Ant
39. JUnit
Java
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Tutorial » Development » Script Engines 
6. 42. 27. Using Java Objects in JavaScript
import javax.script.ScriptEngineManager;
import javax.script.ScriptEngine;
import javax.script.ScriptException;


public class JavaObjectDemo
{  
  public static void main(String[] argsthrows Exception
  {
    ScriptEngineManager manager = new ScriptEngineManager();
    ScriptEngine jsEngine;  
    jsEngine = manager.getEngineByExtension("js");
    jsEngine.eval("importPackage(javax.swing);var optionPane =JOptionPane.showMessageDialog(null, 'Hello!);");
  }
}
6. 42. Script Engines
6. 42. 1. Listing All Script Engines
6. 42. 2. List the script engines
6. 42. 3. Running Scripts with Java Script Engine
6. 42. 4. Execute Javascript script in a file
6. 42. 5. Variables bound through ScriptEngine
6. 42. 6. Catch ScriptException
6. 42. 7. Any script have to be compiled into intermediate code.
6. 42. 8. With Compilable interface you store the intermediate code of an entire script
6. 42. 9. Run JavaScript and get the result by using Java
6. 42. 10. Pass parameter to JavaScript through Java code
6. 42. 11. Get the value in JavaScript from Java Code by reference the variable name
6. 42. 12. Working with Compilable Scripts
6. 42. 13. Call a JavaScript function three times
6. 42. 14. Save the compiled JavaScript to CompiledScript object
6. 42. 15. Invoke an function
6. 42. 16. Using thread to run JavaScript by Java
6. 42. 17. Use jrunscript to execute JavaScript scripts
6. 42. 18. Get Script engine by extension name
6. 42. 19. Get a ScriptEngine by MIME type
6. 42. 20. Retrieving Script Engines by Name
6. 42. 21. Retrieving the Metadata of Script Engines
6. 42. 22. Retrieving the Supported File Extensions of a Scripting Engine
6. 42. 23. Retrieving the Supported Mime Types of a Scripting Engine
6. 42. 24. Retrieving the Registered Name of a Scripting Engine
6. 42. 25. Executing Scripts from Java Programs
6. 42. 26. Read and execute a script source file
6. 42. 27. Using Java Objects in JavaScript
6. 42. 28. Java Language Binding with JavaScript
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.