Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/demo/scripting/jconsole-plugin/README.txt
38829 views
What is this demo about?12This is "script shell" plugin for jconsole - the monitoring and management3client tool shipped with JRE. This plugin adds "Script Shell" tab to jconsole.4This serves as a demo for jconsole plugin API (com.sun.tools.jconsole) as well5as a demo for scripting API (javax.script) for the Java platform.67Script console is an interactive read-eval-print interface that can be used8used to execute advanced monitoring and management queries. By default,9JavaScript is used as the scripting language. The scripting language can be10changed using the system property com.sun.demo.jconsole.console.language. To11use other scripting languages, you need to specify the corresponding engine12jar file in pluginpath along with this plugin's jar file.1314The following 3 global variables are exposed to the script engine:1516window javax.swing.JPanel17engine javax.script.ScriptEngine18plugin com.sun.tools.jconsole.JConsolePlugin1920If you use JavaScript, there are many useful global functions defined in21./src/resources/jconsole.js. This is built into the script plugin jar file.22In addition, you can add other global functions and global variables by23defining those in ~/jconsole.js (or jconsole.<ext> where <ext> is the file24extension for your scripting language of choice under your home directory).2526How do I compile script console plugin?2728You can use the Java based build tool "ant" (http://ant.apache.org) to build29this plugin. To build using ant, please use the following command in the30current directory:3132ant3334How do I use script console plugin?3536To start jconsole with this plugin, please use the following command3738jconsole -pluginpath jconsole-plugin.jar3940How do I load my own script files in script console?4142If you use JavaScript (the default), then there is a global function called43"load" to load any script file from your file system. In script console44prompt, enter the following:4546load(<script-file-path>);4748where <script-file-path> is the path of your script file to load. If you don't49specify the file path, then the load function shows file dialog box to choose50the script file to load.5152How do I get help on script global functions?5354If you use JavaScript (the default), then there is a global function called55"help" that prints one-line help messages on global functions. In script56console prompt, enter the following:5758help();5960Where are the sample JavaScript files?6162./src/scripts directory contains JavaScript files that can be loaded into63script console.646566