Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 8 of 8

Thread: Display Execution Steps - Java Program

  1. #1
    Junior Member
    Join Date
    Sep 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Display Execution Steps - Java Program

    Hello,

    I'm wondering if any of you know how to display the execution steps when you run a java program. I'm taking a class and have completed the work but the instructor has asked us to submit it in such as way that when the program is run it will show which method is executing as it happens. Were are supposed to submit the jar file.

    Eg: when the program is run it should show the following:

    main()
    constructor()
    method1()
    method2()
    etc...

    We are using eclipse so not sure if it's a function built into the IDE or something else that has to be done. Appreciate any advice.

    Max


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Display Execution Steps - Java Program

    System.out.println("functionName()");
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Junior Member
    Join Date
    Sep 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Display Execution Steps - Java Program

    Quote Originally Posted by KevinWorkman View Post
    System.out.println("functionName()");
    Thanks Kevin! Could you elaborate a little I'm not clear on how that would solve the problem...

  4. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Display Execution Steps - Java Program

    I think you're looking for a more complicated solution than is required. At the top of every method, simply print out the name of that method.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5
    Junior Member
    Join Date
    Sep 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Display Execution Steps - Java Program

    Thanks but that won't work. It needs to be automated. So that it prints the method names and constructor names as the program runs. Adding print statements does not solve the problem.

  6. #6
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Display Execution Steps - Java Program

    Quote Originally Posted by Max Avion View Post
    Thanks but that won't work. It needs to be automated. So that it prints the method names and constructor names as the program runs. Adding print statements does not solve the problem.
    Haha okay, if you're sure. I really think you're overthinking this though. I suppose you could look into printing the stack trace though- there's a nice google term for you.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  7. #7
    Junior Member
    Join Date
    Sep 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Display Execution Steps - Java Program

    Ok thanks I will give that a shot. Maybe I am over thinking it but just wasn't sure which way to approach this. Thanks again for your help!

  8. #8
    Forum Squatter newbie's Avatar
    Join Date
    Nov 2010
    Location
    North Wales
    Posts
    661
    My Mood
    Stressed
    Thanks
    28
    Thanked 115 Times in 106 Posts
    Blog Entries
    1

    Red face Re: Display Execution Steps - Java Program

    Quote Originally Posted by Max Avion View Post
    Thanks but that won't work. It needs to be automated. So that it prints the method names and constructor names as the program runs. Adding print statements does not solve the problem.





    Good luck though
    Please use [highlight=Java]//code goes here...[/highlight] tags when posting your code

Similar Threads

  1. Replies: 0
    Last Post: March 16th, 2011, 12:33 AM
  2. setting JDBC driver steps
    By planmaster in forum JDBC & Databases
    Replies: 1
    Last Post: November 6th, 2010, 02:02 PM
  3. java threading execution time question
    By centenial in forum Threads
    Replies: 4
    Last Post: September 8th, 2010, 11:32 PM
  4. Java GUi program Execution
    By Rajan in forum AWT / Java Swing
    Replies: 2
    Last Post: April 19th, 2010, 08:48 PM
  5. program execution with warnings
    By prince joseph in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 28th, 2010, 03:53 PM