File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Printing text file using Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Customer Requirements for Developers this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic

Printing text file using Java

Ashim Kumar

Joined: Mar 13, 2003
Posts: 6
I need to print a text file (say e.g 'bar.txt') from a Java Source Code. Let's say I specify the name of the text file (e.g. 'bar.txt') in my Java Source Code and when I run the Java Code, it should print the text file in the printer. Can anybody tell me, what I need to do? Please specify a block of Code if possible...
Ash :roll:
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
it should print the text file in the printer.

You really mean a printer and not to System.out using System.out.println()?

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Greetings Ash,
Welcome to JavaRanch the absolute best site on the www for Java information. Please do not post the same topic in multiple forums. I am closing this and referring respondants to here.

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
I agree. Here's the link:
subject: Printing text file using Java
It's not a secret anymore!