runtime

Z

zamba

hi..im using this piece of code in a class wich is thread type :

//Se llama al ejecutable de formatter//
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec(_strFormatter + " "+ full_xml_file + " " +
_strXSLFile + " " + full_pdf_file);
InputStream stderr = proc.getErrorStream();
InputStreamReader isr = new InputStreamReader(stderr);
BufferedReader br = new BufferedReader(isr);
String line = null;
System.out.println("");
while ( (line = br.readLine()) != null)
System.out.println(line);
System.out.println("");
int exitVal = proc.waitFor();


this is because i need to call an external program from my class to
convert xml to pdf , im doing this with a class which make run of this
thread class and first one is called about 30.000 times (one for each
xml), but the process is too slow...i suppouse that proc.waitFor and
while...etc..can do my process slow, but i didn't find another wy to
call an external program and test if worked...can anybody help me...tks
 
R

Roedy Green

this is because i need to call an external program from my class to
convert xml to pdf , im doing this with a class which make run of this
thread class and first one is called about 30.000 times (one for each
xml), but the process is too slow...i suppouse that proc.waitFor and
while...etc..can do my process slow, but i didn't find another wy to
call an external program and test if worked...can anybody help me...tks

If you have some control over the source code for the other program
you can:

1. have it communicate via sockets, files, a database... and stay
resident..

2. create a JNI hook to it.

3. rewrite it in Java.

4. write it so that most of it is a DLL that stays resident. You can
then reload it quickly.

If you have no control, you can put it on a RAMDRIVE to help it load
faster.
 

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

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top