Debugging a JavaFX program


Document Status Permanently Updated. Top-level document JavaFXPlugin



This document is intended to collect and track ideas about the Debugger Feature of the JavaFX Plugin for the NetBeans IDE. It will be used as a source for the Debugger Feature Specification. It is also used for refining the Debugger Feature Requirements.

Note: The Java SE platform, version 5.0 MUST BE used as a lowest demonstrator for the Debugger feature of the JavaFX Plugin.

Debugging process

Debugging is a part of the the software development process. Debugging may be performed after some Quality Assurance (QA) activity that showed a negative result. Also, the Debugging process may be initiated by the developer. In this case, the developer will use own expectations instead of the formal requirements.

Context of the Debugging process

}}commentbox The IDEF0 approach is used to describe the Context of the Debugging process. }}

IDEF0 Diagram - A0:Debugging Process


  • Application
application under debug that has runnable status. The application may be compiled with the debug info. In case the interpretable language (script language) is used to describe a program, the interpreter should be used in a role of the application.
  • DCP - Debug Configuration Profile
an informational profile that is used to configure the application before starting it in the debug mode.
  • Application sources
all sources of the application that have been used in building the application. It can be optional if disassembling is supported.
  • Sources of libraries (optional)
Sources of libraries that are used in the Application
  • Test program (optional)
a program that is used to run the Application
  • Test data (optional)
data that is used as the input data for the Application


  • Commands of a developer


  • Source Model View in debug mode
integrates info about sources.
  • Execution (Control Flow) Model View
integrates info about execution mode and control flow, i.e. displays traces of program execution.
  • Breakpoints View
shows info about custom breakpoints.
  • Threads Model View
shows info about debugging sessions (i.e native processes under debug) and the threads in the scopes of these sessions.
  • Data Model View
integrates info about data flow and data evaluation
  • Goal Model View
integrates info about a business target of the application under debugging


  • A debugger (tool/application/software system/software&hardware system)
  • Test framework (optional)

Java SE Debugging

The Java technology offers two interaction levels with a target VM on the Java SE platform: Native level and Java level.


Native level

We need take into account:

  • JVM TI may not be available in all implementations of the Java(tm) virtual machine.
  • JVM TI was introduced in J2SE 5.0 and replaced JVMDI and JVMPI.
  • JVMDI was removed in Java SE 6 and JVMPI will be removed in Java SE 7.


Java level

  • Java(tm) Debug Interface (JDI) is a high level Java API providing information useful for debuggers and similiar systems needing access to the running state of a (usually remote) virtual machine.


JVM Implementation

TODO There are Java Virtual Machines with the different feature sets. See com.sun.jdi.VirtualMachine.canXXX() methods.

Java SE Debugging in the NetBeans IDE


  • debuggercore Debugger Core - Debugger APIs, UI and infrastructure
  • debuggerjpda JPDA Debugger Implementation Plug-In
  • debuggertools
    JDK1.1 (*) Debugger Impl. Plug-In


Java ME Debugging in the NetBeans IDE


JavaFX Debugging vs. Java SE Debugging


Subjects of debugging

In both cases (Java and JavaFX), a JVM is the native application under debug.

There are the following subjects of debugging on the Java level:

Subject Java JavaFX
Set of the related Java classes * pure Java app/lib * pure JavaFX app and JavaFX+Java lib
* stand-alone JavaFX script
Stand-alone Java class * Main class,
* Any class + Main test class/framework

TODO Applet

Entry points

Java JavaFX
The public static void main(String [[[ | []] args) method in the public class A first executable moduleItem in the JavaFX script, i.e. either statement or expression.
See the ANTLR grammar of the JavaFX language.

TODO Applet

Script Context

The Script Context is established by the JSR 223: Scripting for the JavaTM Platform API as the interface javax.script.ScriptContext. According to the specification each script has own context. Script context provides accessibility of entities from inside of the script, including:

  • Set of Attributes. Attribute is the named Java object, whose name is String.
  • Set of Bindings. Bindings is the mapping of key/value pairs, all of whose keys are Strings, i.e it is a set of the named Java objects.
  • Error Writer - a Writer used to display error output.
  • Reader - a Reader to be used by the script to read input.
  • Writer - a Writer for scripts to use when displaying output.

Both Attributes and Bindings are associated with a scope. Each scope is identified by the int value. There are two predefined scopes ENGINE_SCOPE (int value = 100) and GLOBAL_SCOPE (int value = 200). There are no way to find symbolic names for other user-defined scopes.

There are predefined names that are defined as Java language String constants in the interface javax.script.ScriptEngine:

Java Constant Name Java Constant Value Comments
ARGV "javax.script.argv" an array of positional arguments that are passed to a script.
ENGINE "javax.script.engine" the name of the ScriptEngine implementation.
ENGINE_VERSION "javax.script.engine_version" the version of the ScriptEngine implementation.
FILENAME "javax.script.filename" the name of the file being executed.
LANGUAGE "javax.script.language" the full name of Scripting Language supported by the implementation.
LANGUAGE_VERSION "javax.script.language_version" the version of the scripting language supported by the implementation.
NAME "" the short name of the scripting language. The name is used by the ScriptEngineManager to locate a ScriptEngine with a given name in the getEngineByName method.

Also, there are pseudo-variables generated by the JavaFX Script compiler:

JavaFX Constant Name Comments
A URL of the directory where the JavaFX module {.class} file is placed. This value is based on the value of the __FILE__ pseudo-variable. The expression new, ".") is used to calculate that value (See specification of the constructor URL(URL context, String spec)).
A URL of the JavaFX module {.class} file.
A sequence of positional arguments that are passed to a script. Note, elements of the sequence are the same as elements of the array ARGV that is mentioned in the previous table.

JSR 45


JavaFX Script Language and JavaFX Programs


Debugging a program written on a object-oriented language

Debugging a program written on a declarative language

Debugging human interfaces of the JavaFX Programs

Debugging a GUI

  • View of the GUI Components. The view lets to investigate hierarchical trees of the GUI components, including their properties and relations.
  • Event log.
  • User action recorder.
  • User action generator. Should be possible to synchronize the generator with the GUI preview.

Debugging an Audio UI

Debugging a Voice UI

Resources: Voice User Interface (VUI)

Debugging a JavaFX program on other Java platforms

Java ME

Java TV

Debugging Complex Strings

Debugging Triggers

Debugging Binding

Debugging a Program with Loadable Recourses


Debugging Threads

Debugging Remote Application

Debugging Distributed Application

Proposing Solutions

Related Documents

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo