Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
JSDT/Debug/Rhino/Using Rhino Console
JSDT Debug | |
Website | |
Download | |
Community | |
Mailing List • Forums • IRC • mattermost | |
Issues | |
Open • Help Wanted • Bug Day | |
Contribute | |
Browse Source • Project Set File |
Contents
Overview
The Rhino console can be a powerful way to work with JavaScript within Rhino. Simply put, the Rhino console allows you to interact with the Rhino interpreter using System.in and System.out. You can also debug these interactions with a Remote JavaScript launch configuration.
The details of the console, and what it supports can be found here.
Starting the Console
There are many ways to start the console and we will discuss two of them here:
- start the console from an Eclipse workspace
- start the console from a system terminal
From Eclipse
To start the console from within an Eclipse workspace, we first have to get the source for the org.eclipse.wst.jsdt.debug.rhino.debugger
project. This project can be obtained by simply importing the team project set for the JSDT debugger found here.
Once the source has been added to your workspace and has been built, we have to create a new Java Application launch configuration for the org.eclipse.wst.jsdt.debug.rhino.debugger.shell.DebugShell
class. When creating the new launch configuration, there are some options for the launch that we should mention.
The following table summarizes the supported options for launching the Rhino console.
Option | What it does | Example |
---|---|---|
port | Allows you to specify the port that the console should communicate on | -port 5000
|
-suspend | Allows to specify if the console should start and then wait until a debugger connects before continuing | -suspend true OR -suspend y
|
-trace | Allows you to specify if the console should output status messages | -trace true
|
At this point you should have a new Java Application launch configuration that looks like the following (assuming you added the -port
and -suspend
options):
Regardless of your use of the -suspend
option, at this point the console can be connected to by a remote debugger.
From the Terminal
Attaching the Debugger
At this point you should have the Rhino console up and running and see something like the following, either in your terminal or the Eclipse console:
Rhino debugger Start at time: November 19, 2010 11:21:51 CST AM Listening to socket onport: 9000 Started suspended - waiting for client resume...
The next thing we want to do is attach the remote debugger to be able to debug whatever we do in the console.
Console Commands
Very good information about all of the supported commands and their effects can be found here.