简体   繁体   中英

Create a new console when I make a new class instance in Java

I want to be able to have multiple console outputs, one for the main class that I'm running and a second one for the new class that I'm initializing from within the main class, and I can't figure out how to do this in Java.

so for example when I run:

    Server server = new Server(true);
    server.start();

(server extends Thread) I want it to make a new console where its output will go, anyone know how to accomplish this?

Better worded: I want a new window where the System.out.printlns from server will go

If your server runs on a unix based system write the output of your server in an extra output.log file. Then you can open another bash and do the following command:

tail -f /path/output.log

It will show everything that is written into the log file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM