Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

FileNotFoundException when printing on lpt1

807588Jan 19 2009 — edited Mar 5 2009
Hi Everyone

I have 2 different setups of IBM websphere 7.

One on my PC with Java 6 and Windows XP for testing
and one with Java 6 and windows server 2008 for production.

I have mapped my lpt1 on an IP printer port using net use
for ex.
net use lpt1 \\printserver\myprinter
From both systems in DOS console when I type
echo some text > lpt1
The text is printed pefectly.

I used the two code blocks in my testing machine to print some text
FileWriter fw = new FileWriter("lpt1");
fw.write("some text for printing");
fw.close();
FileOutputStream fos = new FileOutputStream( "lpt1" );
fos.write( "some text for printing ".getBytes() );
fos.close(); 
And they both work fine.

BUT when I tryied to do the same on my production machine I java.io.FileNotFoundException: lpt1 (The system cannot find the file specified.)

Can someone please help me?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 2 2009
Added on Jan 19 2009
6 comments
677 views