If you are not using Eclipse for development, you can run the debug proxy and attach another Java technology-enabled debugger to it from the command line.
To run the debugger:
Compile the application's class files using the -g
option. If the -g option is not used, it is not possible to set breakpoints in the source code
Generate APDU scripts for applet installation, instance creation and selection by using the script generator tool (scriptgen.bat
).
Start cref
in debug mode.
You must set the -debugPort
option so that cref
opens the specified port to communication with debug proxy. Without this option, the debugging functionality in cref
is disabled.
For example:
JC_CLASSIC_HOME\bin\cref_tdual.exe -debugPort 9090
[options]
Run the APDU scripts.
APDU scripts can be executed using apdutool.bat
. At a minimum, the installation script must be executed before the debug proxy connects to the VM. Other scripts can be executed later to debug the applet's install()
and process()
methods
Start jc-debug-proxy
as described in Starting the Debugger.
For example:
java.exe -jar lib\jc-debug-proxy.jar -capPath C:\workspace\HelloWorld\deliverables\hello\javacard\hello.cap -vmPort 9090 -port 8000
Attach the debugger to the debug proxy.
NetBeans or any other Java-compatible debugger can be used to connect to the debug proxy using the JDWP protocol. The debugger needs to be configured to connect to the remote Java application running on a specific host and port.
For an example, see:
To run the debug proxy from the command line, use the following command syntax:
java.exe –jar lib\jc-debug-proxy.jar
<debug proxy arguments>
The command line arguments for the debug proxy are:
Command Line Argument | Description |
---|---|
-debug-info |
The source debug-info file that contains debug information for system classes |
-gen-debug-info |
Starts debug proxy in generate debug-info mode to generate the system classes debug information file using .exp files found on the provided path |
-port |
The port that the Java debugger connects to |
-vmPort |
The port that the VM listens on. |
-vmHost |
The hostname of the system the VM is running on |
-capPath |
Required. Path to the cap file(s) being debugged. |
-help |
Short description of help |
For example:
java.exe -jar lib\jc-debug-proxy.jar -capPath C:\workspace\HelloWorld\deliverables\hello\javacard\hello.cap -vmPort 9090 -port 8000