简体   繁体   中英

Ant scripts, debugging JARs and Eclipse

For a class project, I'm working with the Sphinx open source speech recognition framework produced by Carnegie Mellon University. This is my first exposure to using ant to build applications, and its been an interesting time.

I've written an application whose goal is to take in audio input from either microphone input or a WAV file, transcribe it using one of two available configurations, and output the words as well as the confidence scoring. The code I wrote works, except for the confidence scoring of words. That code was adapted from a demonstration utility included with the svn checkout and that utility works as advertised. However, in my project, it throws a NullPointerException, and I can't figure out why from the code alone.

Since this application is built using ant, I know I need to insert some code in the buildscript to allow debugging. This question was helpful in understanding what to do, but I have no idea where to insert that code. I'm assuming its in the header, but the source really shows no place to include JVM arguments.

How do I accomplish debugging in this situation?

To debug your code, use a debugger. Every IDE has one. The JVM arguments in the question you linked to are used to be able to start an application from outside the IDE, possibly on a different host, and remotely debug this application from within the IDE. From your question, I don't think you need this. You just have to run your application in debug mode from the IDE.

Note that a NullPointerException rarely needs any debugging: its stack trace tells you exactly at which line it occurs, and the cause is usually that you're calling a method on a null object.

In Eclipse, check under your project properties-> Java Build Path-> Source Tab. See if all your relevant source is included there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM