newbie questions
"Jason Sachs" <[email protected]> Thu, 24 Jul 2008 11:22:29 -0400
| Newsgroups | gmane.comp.java.jswat.user |
|---|---|
| Message-ID | <[email protected]> |
I am able to set breakpoints in jswat, but for some reason it can't
access local variables & I'm not sure what I'm doing wrong. Also in
the following program, System.console() returned null; the program
runs fine running java standalone or by attaching jswat to a
jswat-enabled java process. (this is from one of the standard java
tutorials on regexps)
package test.regexp;
import java.io.Console;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
public class test1 {
public static void main(String[] args){
Console console = System.console();
if (console == null) {
System.err.println("No console.");
System.exit(1);
}
while (true) {
Pattern pattern =
Pattern.compile(console.readLine("%nEnter your regex: "));
Matcher matcher =
pattern.matcher(console.readLine("Enter input string to search: "));
boolean found = false;
while (matcher.find()) {
console.format("I found the text \"%s\" starting at " +
"index %d and ending at index %d.%n",
matcher.group(), matcher.start(), matcher.end());
found = true;
}
if(!found){
console.format("No match found.%n");
}
}
}
}
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/