0N/AWhat is this demo about?
0N/A
0N/AThis is "script shell" plugin for jconsole - the monitoring and management
0N/Aclient tool shipped with JRE. This plugin adds "Script Shell" tab to jconsole.
0N/AThis serves as a demo for jconsole plugin API (com.sun.tools.jconsole) as well
0N/Aas a demo for scripting API (javax.script) for the Java platform.
0N/A
0N/AScript console is an interactive read-eval-print interface that can be used
0N/Aused to execute advanced monitoring and management queries. By default,
0N/AJavaScript is used as the scripting language. The scripting language can be
0N/Achanged using the system property com.sun.demo.jconsole.console.language. To
0N/Ause other scripting languages, you need to specify the corresponding engine
0N/Ajar file in pluginpath along with this plugin's jar file.
0N/A
0N/AThe following 3 global variables are exposed to the script engine:
0N/A
0N/A window javax.swing.JPanel
0N/A engine javax.script.ScriptEngine
0N/A plugin com.sun.tools.jconsole.JConsolePlugin
0N/A
0N/AIf you use JavaScript, there are many useful global functions defined in
0N/A./src/resources/jconsole.js. This is built into the script plugin jar file.
0N/AIn addition, you can add other global functions and global variables by
0N/Adefining those in ~/jconsole.js (or jconsole.<ext> where <ext> is the file
0N/Aextension for your scripting language of choice under your home directory).
0N/A
0N/AHow do I compile script console plugin?
0N/A
0N/AYou can use the Java based build tool "ant" (http://ant.apache.org) to build
0N/Athis plugin. To build using ant, please use the following command in the
0N/Acurrent directory:
0N/A
0N/A ant
0N/A
0N/AHow do I use script console plugin?
0N/A
0N/ATo start jconsole with this plugin, please use the following command
0N/A
0N/A jconsole -pluginpath jconsole-plugin.jar
0N/A
0N/AHow do I load my own script files in script console?
0N/A
0N/AIf you use JavaScript (the default), then there is a global function called
0N/A"load" to load any script file from your file system. In script console
0N/Aprompt, enter the following:
0N/A
0N/A load(<script-file-path>);
0N/A
0N/Awhere <script-file-path> is the path of your script file to load. If you don't
0N/Aspecify the file path, then the load function shows file dialog box to choose
0N/Athe script file to load.
0N/A
0N/AHow do I get help on script global functions?
0N/A
0N/AIf you use JavaScript (the default), then there is a global function called
0N/A"help" that prints one-line help messages on global functions. In script
0N/Aconsole prompt, enter the following:
0N/A
0N/A help();
0N/A
0N/AWhere are the sample JavaScript files?
0N/A
0N/A./src/scripts directory contains JavaScript files that can be loaded into
0N/Ascript console.