• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Writing output to the console

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Me and my colleagues are trying to simulate a Network Printing Project on a single machine.We are trying to simulate multiple printers on Server side.

We are representing individual consoles for each printer so that when our code assigns printing jobs to printers (by giving a text file as a feed to the Printer) then that number of consoles will get open and printing can be simulated by displaying content at say 'x' characters/second.

So I would like to ask that whether there are any APIs in Java for opening consoles and writing the content or can we see the output getting printed
into another file if we open that file on another console.

Thank You,

Regards,
Kedar Patwardhan.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's no Java API specific to opening a console. You could probably use java.lang.Runtime.exec() to run your platform's command interpreter (i.e. cmd on Windows or sh/bash/ksh. . . on *nix) and feed it data through the streams provided. Runtime.exec has some peculiararities. See this article for details.
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is no API that will allow you to open a console. But you could save to a file and then open it when desired to check if there is any data. Alternatively you can keep polling to check if the files exist and then print the data in every file to one console ( the console in which you java program runs ).
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why don't you use multiple Panels, or one Panel, with multiple Textareas or something like that?
 
What's a year in metric? Do you know this metric stuff tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic