Debugging the HelloWorld Sample from the Command Line

To debug the HelloWorld sample from the command line:
  1. Open a Command Prompt window and perform the following:
    1. Navigate to the JC_HOME_SIMULATOR\bin directory.
    2. Start the simulator by entering the following command at the command prompt:

      cref –o hello.eeprom

      Note:

      The -o command line option instructs cref to save the EEPROM data to the hello.eeprom file before terminating.

  2. Open a second Command Prompt window and perform the following:
    1. Navigate to the JC_HOME_SIMULATOR\samples\classic_applets\HelloWorld\applet directory.
    2. Open the applet.opt file in a text editor and add a new line with -debug option. This option will be passed to the converter to generate debug information.
    3. At the command prompt, invoke ant with a target set to all. The output file is default.out or, optionally, you can specify a different output file with the -D parameter:

      ant -Dredirect.output=outputfile_name all

      This builds the applet, executes the APDU script, and creates an output file in the applet directory.
  3. cref terminates. Restart it in the first window by entering this command:

    cref –debugPort 9090 –i hello.eeprom

  4. In the second command prompt, navigate to the JC_HOME_SIMULATOR\lib directory and start the debug proxy:
    java.exe -jar jc-debug-proxy.jar -capPath JC_HOME_SIMULATOR\samples\classic_applets\HelloWorld\applet\build\classes\com\sun\jcclassic\samples\helloworld\javacard\helloworld.cap
  5. Start the Java debugger of your choice and attach it to the 8000 port of the local host.
  6. Now you can set a break point and see it hit after a proper APDU is issued using the apdutool.