## Overview of BIRT scripting

When developing a BIRT report using the Eclipse Workbench, you can write custom event handlers in either Java or JavaScript. When developing a BIRT report using the Eclipse RCP, you can write only JavaScript event handlers. Whether you use Java or JavaScript, the set of event handlers that you can write is the same.

### Choosing between Java and JavaScript

Both Java and JavaScript have advantages and disadvantages when writing an event handler. For a developer who is familiar with only one of the two languages, the advantage of using the familiar language is obvious but for all others, the decision depends on the report requirements.

The advantages of using JavaScript to write an event handler include:

- Ease of adding a simple script for a particular event handler
Adding a JavaScript event handler to a report is less complicated than adding a Java event handler. When writing a JavaScript event handler, there is no need to create a Java environment in Eclipse or to learn the Eclipse Java development process. You are not required to specify a package, implement an interface, or know the parameters of the event handler you write.
To add a JavaScript event handler, you type the code for the event handler on the Script tab after selecting the name of the event handler from a drop-down list.
- Simpler language constructs, looser typing, and less strict language rules
JavaScript is less demanding to code than Java due to simpler language constructs, looser typing, and less strict language rules.

The advantages of using Java to write an event handler include:

- Availability of the Eclipse Java development environment
The Eclipse Java development environment is very powerful, and includes such features as autocompletion, context sensitive help, keyboard shortcuts, parameter hints, and much more.
- Ease of finding and viewing event handlers
All the Java event handlers for a report exist in readily viewable Java files. By contrast, the JavaScript event handlers are embedded in the design and you can view only one handler at a time.
- Access to an integrated debugger
The integrated debugger only supports Java event handlers, not JavaScript event handlers.

### Using both Java and JavaScript to write event handlers

You are not limited to writing all event handlers in one language. You can write some in Java and others in JavaScript. If you have both a Java and a JavaScript event handler for the same event, BIRT uses the JavaScript handler.

You can run the report outside of the previewer by choosing File->View Report->View Report in Web Viewer.