Page 1 of 3 123 Last
  • Jump to page:
    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    20
    Rep Power
    0

    Exclamation Static void is not being reached


    When the main void executes this:

    Code:
    public static void load(){ 
    DialogueHandler.sendText1("test");
    }
    SendText1:
    Code:
    public static void sendText1(String text){
    Logger.log("done"); //Test if void was reached
    Window.jTextArea1.append(text + newLine);
    }
    The application completely stops at this point in the load void and nothing is logged nor added to the TextArea. Why is this happening?

    EDIT: They are in separate classes
  2. #2
  3. Java Junkie
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jan 2004
    Location
    Mobile, Alabama
    Posts
    4,022
    Rep Power
    1285
    Do you call them from the main method?
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    20
    Rep Power
    0
    Originally Posted by bullet
    Do you call them from the main method?
    No doesn't work
  6. #4
  7. Java Junkie
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jan 2004
    Location
    Mobile, Alabama
    Posts
    4,022
    Rep Power
    1285
    Originally Posted by fantity
    No doesn't work
    If it's an application, nothing is going to be executed unless it's called by the main method.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    20
    Rep Power
    0
    Originally Posted by bullet
    If it's an application, nothing is going to be executed unless it's called by the main method.
    It is;

    Main method:
    Code:
    public static void main(String[] args){ 
    load(); 
    }
  10. #6
  11. Java Junkie
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jan 2004
    Location
    Mobile, Alabama
    Posts
    4,022
    Rep Power
    1285
    Originally Posted by fantity
    It is;

    Main method:
    Code:
    public static void main(String[] args){ 
    load(); 
    }
    When you say the application stops, does it print an error message?
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    20
    Rep Power
    0
    Originally Posted by bullet
    When you say the application stops, does it print an error message?
    There's no error message even with Try & Catch
  14. #8
  15. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,714
    Rep Power
    348
    Add some printlns to print out messages at every statement that you expect to execute.
    The last message printed out will show you where the last statement executed was.
    You'll know that execution stopped before the next println was executed because its message won't have printed.
  16. #9
  17. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    20
    Rep Power
    0
    Originally Posted by NormR
    Add some printlns to print out messages at every statement that you expect to execute.
    The last message printed out will show you where the last statement executed was.
    You'll know that execution stopped before the next println was executed because its message won't have printed.
    I have done that and it doesn't print or continue after the sendText void.
  18. #10
  19. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,714
    Rep Power
    348
    I'm not sure where the printlns are located from what you've said. I don't see a "sendText void". I do see void sentText1( in two places: one where it is called and one where it is defined.

    What is the last println() that is printed? What println is not printed?
    Post the code that shows where the printlns are located in the code
    and post the output from the program running when it prints out the messages.
  20. #11
  21. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    20
    Rep Power
    0
    Originally Posted by NormR
    I'm not sure where the printlns are located from what you've said. I don't see a "sendText void". I do see void sentText1( in two places: one where it is called and one where it is defined.

    What is the last println() that is printed? What println is not printed?
    Post the code that shows where the printlns are located in the code
    and post the output from the program running when it prints out the messages.
    Code:
    public static void load(){	
    	window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    		window.setVisible(true);
    		System.out.println("done1");
    		DialogueHandler.sendText1("test");
    		System.out.println("done2");
    }
    
    public static void sendText1(String text){
    		System.out.println("done3");
    		Window.jTextArea1.append(text + newLine);
    	}
    Output:
  22. #12
  23. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,714
    Rep Power
    348
    It looks like there is another version of the method that is being called instead of the code you posted. Otherwise done3 would print.
  24. #13
  25. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    20
    Rep Power
    0
    Originally Posted by NormR
    It looks like there is another version of the method that is being called instead of the code you posted. Otherwise done3 would print.
    Except it doesn't.
  26. #14
  27. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,714
    Rep Power
    348
    Make a small complete program that compiles, executes and shows the problem and paste it here so we can test it.
  28. #15
  29. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    20
    Rep Power
    0
    Originally Posted by NormR
    Make a small complete program that compiles, executes and shows the problem and paste it here so we can test it.
    Do you have skype?
Page 1 of 3 123 Last
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo