Runtime.getRuntime().exec PROBLEM

M

Mao

Hi.
I'm trying to print a document using the acrord32 or gsprint command
directly from my java program named "cde".

The problem is that: If i run multiple instance of my program "cde",
sometimes the adobe or gs print only one document and not the other
especially if I run em both in a short temporal distance.
To solve the problem I'm trying to know if acrord32 or gs are already
printing a document and waiting until there is no document.

Is there a way to know that?? ( using J2EE )
Is there another way to solve the problem??

Thanks in advance
 
G

Gordon Beaton

I'm trying to print a document using the acrord32 or gsprint command
directly from my java program named "cde".

The problem is that: If i run multiple instance of my program "cde",
sometimes the adobe or gs print only one document and not the other
especially if I run em both in a short temporal distance.
To solve the problem I'm trying to know if acrord32 or gs are already
printing a document and waiting until there is no document.

Is there a way to know that?? ( using J2EE )
Is there another way to solve the problem??

Is gsprint the following script?

http://www.linuxjournal.com/modules.php?op=modload&name=NS-lj-issues/issue47&file=2328l1

If so, the problem is that it always spools to the same temporary
file, but it's easily fixed. Edit the script, and replace each
occurrence of "/tmp/gs.out" with "/tmp/gs-$$.out".

Acroread has a similar problem that you might be able to solve by
specifying separate temp directories each time you run it (i.e. by
setting TMP or TMPDIR), however I haven't looked more closely than
that.

/gordon
 
M

Mao

Gordon Beaton said:
Is gsprint the following script?

http://www.linuxjournal.com/modules.php?op=modload&name=NS-lj-issues/issue47&file=2328l1

If so, the problem is that it always spools to the same temporary
file, but it's easily fixed. Edit the script, and replace each
occurrence of "/tmp/gs.out" with "/tmp/gs-$$.out".

Acroread has a similar problem that you might be able to solve by
specifying separate temp directories each time you run it (i.e. by
setting TMP or TMPDIR), however I haven't looked more closely than
that.

/gordon

Sorry but the gsprint is running on a Win2000 machine and is an .exe .
Honestly I can't find the right way to obtain that every gsprint use
is own spool file.
Unlucky, the gsprint is launched very often becouse is installed on a
server that is dedicated to accept output files from a DB, make some
elaboration on these files, and finally print the resulting data on a
pdf using the iText. Potentially more than 30 user can launch a print
job :( and the great problem is when 2 or more send a job
concurrently.

I have tried something like this:

try{
p = Runtime.getRuntime().exec ("gsprint -printer......") //
pseudocode
p.waitFor();
}
catch(Exception e){
}


but the print process doesn't start and i must kill gsprint process to
delete the print job from the printer.

I think that if I can't figure out if a gsprint process is already
running I can solve the problem, becouse I will delay the new print
process. So I started a new thread, excuse me if that is wrong.

Another idea: If I convert the file to a ps, can use the JAVA
printing library?

Any suggestion?

Thanks in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top