house fly

JSwat Project

JSwat FAQ


Frequently Asked Questions

The following are a list of frequently asked questions about both the JSwat project and the Java Platform Debugger Architecture. You may want to check out my Java FAQ page as well.

About Questions

  1. How is JSwat used? What is the JPDA and what role does it play?
  2. How should I set up JPDA and JSwat?
  3. Which version of the JDK and JPDA should I be using to run JSwat?

Setting Up, Starting Questions

  1. When I start JSwat I get an error about the JIT compiler.
  2. When I start JSwat and try to load a class to debug, I get the error "can't load 'jdwp.dll'".
  3. When I start JSwat and try to load a class to debug, I get the error "can't load 'libjdwp.so'".
  4. When I try to start JSwat like so "java -jar jswat.jar", it fails. It prints a message "Missing JPDA package."
  5. When I launch my program in JSwat it has problems, but it runs fine without JSwat.

Using Questions

  1. When I type 'resume' to begin running my program from within JSwat, the debugger seems to hang.
  2. When I try to start my debuggee class with the "load myClass" command, it fails, saying the debuggee VM exited.
  3. When I single step over a method that attempts to read input from the standard input, the call hangs.
  4. The thread status seems to always say "UNKNOWN".
  5. Debugging seems very slow, especially the startup time of my program.
  6. I cannot get JSwat to show me the values of any variables. It seems that JSwat thinks there is "no variable information for that class".
  7. Some local variables seem to be invisible to the debugger. The code compiles and runs fine, but the debugger is unable to display the variables.
  8. JSwat tells me that it cannot find my source files. Why is that?

Breakpoint Questions

  1. Setting breakpoints seems to be failing.
  2. I am having trouble setting breakpoints in a particular class. It seems that JSwat thinks there is "no line number information for that class".
  3. I keep getting "no code at that line" messages when starting the debuggee.

Console Questions

  1. When using JSwat via the console mode, I cannot enter very long commands, such as to set a long classpath. It seems to limit to 256 characters.

About Answers

  1. How is JSwat used? What is the JPDA and what role does it play?
    JSwat is a Java application which utilizes the classes provided in JavaSoft's Java Platform Debuggger Architecture (JPDA). JPDA provides the back-end support for debugging Java classes. To use JSwat you will need a JDK and JPDA installed on your system, and the JPDA jar file must be in your classpath. The JPDA classes may be in a file called jpda.jar or tools.jar somewhere in your JDK tree.
  2. How should I set up JPDA and JSwat?
    See the JSwat Installation instructions for all the necessary details.
  3. Which version of the JDK and JPDA should I be using to run JSwat?
    You'll need to be using a Java 2 platform compatible development kit, such as JavaSoft's JDK 1.2 or 1.3. Java 1.1 will not work. You will also need the latest version of JPDA, whatever that may be. JSwat will always be kept up to date with the latest JPDA, so if you're having problems running JSwat, be sure to check that you've got the latest version of both JSwat and JPDA.

Setting Up, Starting Answers

  1. When I start JSwat I get an error about the JIT compiler.
    You cannot debug using the JPDA with the JIT compiler turned on. Turn off the JIT compiler. This is easily done by passing the "-Djava.compiler=NONE" switch to java when starting JSwat and/or your application. You could also define the environment variable JAVA_COMPILER, setting it to "NONE". See the JPDA documentation for the details.
  2. When I start JSwat and try to load a class to debug, I get the error "can't load 'jdwp.dll'".
    You need to make sure the JPDA 'lib' directory is in your PATH environment variable. In this case, the 'jdwp.dll' file is missing from your PATH and the JVM cannot find the file when JPDA initializes. Locate the directory containing the 'jdwp.dll' file and make sure that is in your PATH.
  3. When I start JSwat and try to load a class to debug, I get the error "can't load 'libjdwp.so'".
    You need to make sure the JPDA 'lib/i386' or 'lib/sparc' directory is in your LD_LIBRARY_PATH environment variable. In this case, the 'jdwp.dll' file is missing from your LD_LIBRARY_PATH and the JVM cannot find the file when JPDA initializes. Locate the directory containing the 'jdwp.dll' file and make sure that is in your LD_LIBRARY_PATH.
  4. When I try to start JSwat like so "java -jar jswat.jar", it fails. It prints a message "Missing JPDA package."
    When you use the -jar option, the JVM ignores all other classpath settings. There are a few options for running JSwat from the jar file.
  5. When I launch my program in JSwat it has problems, but it runs fine without JSwat.
    If you are running on a Windows platform, try the steps given here, under the heading of the "JDK versus JRE". If you are not running Windows, tell me about the problem: nfiedler at bluemarsh.com.

Using Answers

  1. When I type 'resume' to begin running my program from within JSwat, the debugger seems to hang.
    You are probably running the HotSpot VM on Linux in JDK 1.3. The HotSpot VM is still not very good for debugging and you will need to use the Classic VM instead. See the Run Classic VM page.
  2. When I try to run my debuggee class with the "load myClass" command, it fails, saying the debuggee VM exited.
    If you check the "Output" panel (one of the tabbed panels in the bottom half of the JSwat window) you will probably see a message that says the class was not found. You need to set the classpath in your environment before running JSwat, to make sure the directory containing 'myClass' is included.
  3. When I single step over a method that attempts to read input from the standard input, the call hangs.
    Press the Refresh button and that will free up jswat from its hang up. For some reason on green threaded systems, jswat hangs when attempting to send input to the debuggee VM. It works fine on Win32 systems but not on Linux.
  4. The thread status seems to always say "UNKNOWN".
    Make sure you are not running the HotSpot VM. If you are, try running JSwat and your debuggee VM with the Classic VM (see the Run Classic VM page).
  5. Debugging seems very slow, especially the startup time of my program.
    Are you running the HotSpot VM? If so, turn it off. It can greatly affect the run time of your program during debugging. See the Run Classic VM page.
    You might also try remotely debugging your program. That is, start your program using the JVM arguments described here and then attach JSwat to the running program.
  6. I cannot get JSwat to show me the values of any variables. It seems that JSwat thinks there is "no variable information for that class".
    Recompile your classes with the -g option. This turns on the debugging information when the compiler generates the .class files. This is necessary for any Java debugger that you would use.
  7. Some local variables seem to be invisible to the debugger. The code compiles and runs fine, but the debugger is unable to display the variables.
    It is unclear if the Java compiler or the Java VM is at fault here. Either way, the solution tends to be simple -- assign an initial value to the variable when you define it. That is, instead of "String s1;" you would write "String s1 = null;". This makes the variable appear to the debugger.
  8. JSwat tells me that it cannot find my source files. Why is that?
    JSwat uses the classpath and sourcepath to locate source files. Check that these are set with appropriate values. Also read the Paths howto document to learn all about the classpath and sourcepath.

Breakpoints Answers

  1. Setting breakpoints seems to be failing.
    First, are you running the HotSpot VM? Try running JSwat and your debuggee VM with the Classic VM (see the Run Classic VM page). Older versions of HotSpot seem to have a couple of major flaws, handling breakpoints is one of them.
    Second, are you using Enterprise Java Beans? There seems to be a problem with setting breakpoints in session beans. Whether this problem lies in JPDA, JSwat, or the application server I am not sure.
  2. I am having trouble setting breakpoints in a particular class. It seems that JSwat thinks there is "no line number information for that class".
    This may be caused by the java compiler. If you are using jikes, it could be generating invalid debugging information which gives JPDA a headache. Try using the javac compiler that comes with the JDK and see if that helps. Sometimes I find that deleting all the class files and recompiling will work.
  3. I keep getting "no code at that line" messages when starting the debuggee.
    This is likely caused by a breakpoint that was set on a line of code that has moved to another line. That is, you set a breakpoint at line X, then modified the code so that the code at X is now at Y. Meanwhile JSwat keeps trying to resolve the breakpoint at line X. Simply delete or edit the breakpoint specification to resolve this issue.

Console Answers

  1. When using JSwat via the console mode, I cannot enter very long commands, such as to set a long classpath. It seems to limit to 256 characters.
    It seems that on Solaris, the terminal driver is set to only allow canonical input lines of up to 256 characters. You may need to use a different terminal emulator or command interpreter to avoid this issue.


Back to Documentation