Re: newbie questions
Nathan Fiedler <[email protected]> Thu, 24 Jul 2008 12:03:54 -0700 (PDT)
| Newsgroups | gmane.comp.java.jswat.user |
|---|---|
| Message-ID | <[email protected]> |
Make sure to compile the code using "javac -g" so the local variable table information is generated. Otherwise no Java debugger will be able to show you the local variables for that class. As for the console, I would guess that the JVM detects that it is not running in a terminal and thus disables the console support. That is, when launched inside JSwat, it's "embedded" and therefore there is no console. Try launching your class with the debugging flags (see the JSwat help) and attach JSwat to it. Then the console should work. n ----- Original Message ---- From: Jason Sachs <[email protected]> To: [email protected] Sent: Thursday, July 24, 2008 8:22:29 AM Subject: [jswat-user] newbie questions 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=/ _______________________________________________ jswat-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jswat-user ------------------------------------------------------------------------- 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=/