On 12 October 2010 11:57, F2Andy <andy.j...@f2chemicals.com> wrote:

> To
> print, it creates a new file, which is then copied to lpt4: (which is
> actually a USB port on a networked computer, via "net use")
>
> Exactly where and when is the "net use" running?  There are two key points
with Windows services:

1) A service starts with its own copy of the environment, so even if it is
running as the same user as the console user it does not share drive or
device mappings;

2) A service does not get a fully-processed copy of the environment, so
drive and device mappings are not restored from the environment.

So:

a) Make sure your Tomcat service is running as a user that is known to the
network (not "Local service", "Local system" or an account that is local to
the server), otherwise your service will be unable to authenticate to the
machine with the printer;

b) Write yourself a batch file that does the net use and the copy, and
invoke *that* from your system command.

Hope this helps you resolve the problem!

- Peter

Reply via email to