blob: fc4bbf199aa2aa244ca92dc7457a5e2f624660c9 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001What is this demo about?
2
3This is "script shell" plugin for jconsole - the monitoring and management
4client tool shipped with JRE. This plugin adds "Script Shell" tab to jconsole.
5This serves as a demo for jconsole plugin API (com.sun.tools.jconsole) as well
6as a demo for scripting API (javax.script) for the Java platform.
7
8Script console is an interactive read-eval-print interface that can be used
9used to execute advanced monitoring and management queries. By default,
10JavaScript is used as the scripting language. The scripting language can be
11changed using the system property com.sun.demo.jconsole.console.language. To
12use other scripting languages, you need to specify the corresponding engine
13jar file in pluginpath along with this plugin's jar file.
14
15The following 3 global variables are exposed to the script engine:
16
17 window javax.swing.JPanel
18 engine javax.script.ScriptEngine
19 plugin com.sun.tools.jconsole.JConsolePlugin
20
21If you use JavaScript, there are many useful global functions defined in
22./src/resources/jconsole.js. This is built into the script plugin jar file.
23In addition, you can add other global functions and global variables by
24defining those in ~/jconsole.js (or jconsole.<ext> where <ext> is the file
25extension for your scripting language of choice under your home directory).
26
27How do I compile script console plugin?
28
29You can use the Java based build tool "ant" (http://ant.apache.org) to build
30this plugin. To build using ant, please use the following command in the
31current directory:
32
33 ant
34
35How do I use script console plugin?
36
37To start jconsole with this plugin, please use the following command
38
39 jconsole -pluginpath jconsole-plugin.jar
40
41How do I load my own script files in script console?
42
43If you use JavaScript (the default), then there is a global function called
44"load" to load any script file from your file system. In script console
45prompt, enter the following:
46
47 load(<script-file-path>);
48
49where <script-file-path> is the path of your script file to load. If you don't
50specify the file path, then the load function shows file dialog box to choose
51the script file to load.
52
53How do I get help on script global functions?
54
55If you use JavaScript (the default), then there is a global function called
56"help" that prints one-line help messages on global functions. In script
57console prompt, enter the following:
58
59 help();
60
61Where are the sample JavaScript files?
62
63./src/scripts directory contains JavaScript files that can be loaded into
64script console.