Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8135389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:24:11+00:00 2026-06-06T10:24:11+00:00

Is there anyway to get or intercept the output stream (System.out in particular) from

  • 0

Is there anyway to get or intercept the output stream (System.out in particular) from a class’s method that has been invoked within my program?

I am creating a new Method object called main, using URLClassLoader to load in the class, and then calling main.invoke(); with proper arguments.

I want to be able to capture the output from that method’s execution, it is okay for it to still display to the screen, but I need to be able to process the output as well.

Note: This method is actually a server application that will run continuously.

Please let me know if any more clarification is needed, and also let me know if anything like this is even possible.

Thanks for any help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T10:24:12+00:00Added an answer on June 6, 2026 at 10:24 am

    Assuming you are talking about the System.out or System.err output streams…

    The best way to implement what you suggest is to pass the OutputStream as an argument. This could be System.out but can easily be changed to whatever you want.

    A way to do this without passing an argument is to replace the default System.out with your own which checks the stack to determine where it was called from. I would suggest you do this unless there is no other option. e.g. you have no access to the code of the method you are calling.

    If you are talking about some other OutputStream, you would have to replace the code for the outputstream used with one which allows you to trace the output. This is the hackiest solution but it would work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

is there anyway to get the class when click event is fired. My code
Is there anyway to get access to stackoverflow's awesome tagging system? I would like
Is there anyway to use pygame to get input from the console, rather than
Is there anyway to get the Facebook ID of a user without forcing them
Is there anyway to get the alt tag to display quicker? Also, I notice
Is there anyway to get the actual images used in resources? e.g., I want
Is there anyway to take a binary - even signed by yourself, and get
I have a web application that has been running just fine in Internet Explorer
Is there any way to get the status of the Battery (charging/discharging/Current Charge/Capacity/etc...) from
Is there any way to get the previous hash using the history object ?I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.