2012-03-27 4 views
1

Netbeans IDE 7.1을 사용 중이고 간단한 프로그램을 디버그하려고했는데 변수 출력 창에 "현재 스레드가 없기 때문에 표시 할 변수가 없습니다"라는 메시지가 있습니다. 그게 무슨 소리 야? 감사. :)Java 프로그램 디버깅. Netbeans IDE 7.1을 사용하여

여기 내 코드입니다 : 코드 실행이 중단 점을 통하거나 디버깅하는 동안 일시 정지를 눌러 통해서 중단되는 동안

public class SwingExercise { 

public static void main(String[] args) { 


    String name = ""; 
    String pw = ""; 
    boolean input = true; 
    boolean hasDigit = true; 
    while (input) { 
     try { 

      while (name.equals("")) { 

       name = JOptionPane.showInputDialog(null, "Enter username:"); 
       if (name.equals("")) { 
        JOptionPane.showMessageDialog(null, "No input.", "Error", JOptionPane.ERROR_MESSAGE); 
        name = ""; 
       } 

       while (hasDigit) { 
        for (int i = 0; i < name.length(); i++) { 
         if (Character.isDigit(name.charAt(i))) { 
          throw new InputMismatchException(); 
         } 
        } 
        hasDigit = false; 
       } 
      } 


      while (pw.equals("")) { 
       pw = JOptionPane.showInputDialog(null, "Enter password:"); 
       if (pw.equals("")) { 
        JOptionPane.showMessageDialog(null, "No input.", "Error", JOptionPane.ERROR_MESSAGE); 
        pw = ""; 
       } 
      } 
     } catch (NullPointerException e) { 
      System.exit(0); 
     } catch (InputMismatchException e) { 
      JOptionPane.showMessageDialog(null, "Invalid input.", "Error", 
        JOptionPane.INFORMATION_MESSAGE); 
      name = ""; 
     } 
    } 
} 

}

답변

0

그래서 당신은 단지 변수를 볼 수 있습니다. 그런 다음 왼쪽의 스레드 목록에서 프로그램의 주 스레드를 선택해야 할 수도 있습니다. 이 시점에서 변수가 표시되어야합니다.