UNPKG

epubjs

Version:

Render ePub documents in the browser, across many devices

19 lines (18 loc) 3.18 kB
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><title>Running BeanShell</title><link rel="stylesheet" href="core.css" type="text/css"/><meta name="generator" content="DocBook XSL Stylesheets V1.74.0"/></head><body><div class="sect1" title="Running BeanShell"><div class="titlepage"><div><div><h1 class="title"><a id="learnjava3-APP-B-SECT-1"/>Running BeanShell</h1></div></div></div><p><a id="idx11251" class="indexterm"/> All you need to run BeanShell is the Java runtime system (version 1.1 or greater) and the <a id="I_indexterm_id838811" class="indexterm"/><span class="emphasis"><em>bsh</em></span> JAR file. Under Mac OS X and Windows, you can launch a graphical desktop for BeanShell by simply double-clicking the JAR file. More generally, you can add the JAR to your classpath:</p><a id="I__tt1365"/><pre class="programlisting"> <code class="nl">Unix:</code> <code class="n">export</code> <code class="n">CLASSPATH</code><code class="o">=</code><code class="n">$CLASSPATH</code><code class="o">:</code><code class="n">bsh</code><code class="o">.</code><code class="na">jar</code> <code class="nl">Windows:</code> <code class="n">set</code> <code class="n">classpath</code> <code class="o">%</code><code class="n">classpath</code><code class="o">%;</code><code class="n">bsh</code><code class="o">.</code><code class="na">jar</code></pre><p>You can then run BeanShell interactively in either a GUI or command-line mode:</p><a id="I__tt1366"/><pre class="programlisting"> <code class="n">java</code> <code class="n">bsh</code><code class="o">.</code><code class="na">Console</code> <code class="c1">// run the graphical desktop</code> <code class="n">java</code> <code class="n">bsh</code><code class="o">.</code><code class="na">Interpreter</code> <code class="c1">// run as text-only on the command line</code></pre><p>Running BeanShell with the GUI console brings up a simple, Swing-based desktop that allows you to open multiple shell windows with basic command history, line editing, and cut-and-paste capability. There are some other GUI tools available as well, including a simple text editor and class browser. Alternately, you can run BeanShell on the command line, in text-only mode.</p><p>You can run BeanShell scripts from files, like so:</p><a id="I__tt1367"/><pre class="programlisting"> <code class="o">%</code> <strong class="userinput"><code><code class="n">java</code> <code class="n">bsh</code><code class="o">.</code><code class="na">Interpreter</code> <code class="n">myfile</code><code class="o">.</code><code class="na">bsh</code></code></strong></pre><p>Within some versions of the NetBeans and Sun Java Studio IDEs, you can create BeanShell script files using the New File wizard or run any file with a <a id="I_indexterm_id838867" class="indexterm"/><span class="emphasis"><em>.bsh</em></span> extension just as you would execute Java code.<a id="I_indexterm_id838876" class="indexterm"/></p></div></body></html>