Hi can somebody help at the earliest . My requirement is to download a file from the remote server and read it in order to insert into db. So, i have written a shell script that downloads the file. This has to be invoked by a java program, after downloading it has to be read by the java program. Please find the code below: it give me the below error:
java.lang.IllegalThreadStateException: process hasn't exited
[1/4/11 14:59:01:290 CST] 0000003b SystemErr R at java.lang.UNIXProcess.exitValue(UNIXProcess.java:322)
[1/4/11 14:59:01:290 CST] 0000003b SystemErr R at services.in.cat.CATInterfacing.callDCATJob(CATInterfacing.java:124)
[1/4/11 14:59:01:291 CST] 0000003b SystemErr R at services.in.schedule.jobs.SchedulerJOBForcat.execute(SchedulerJOBForcat.java:31)
[1/4/11 14:59:01:291 CST] 0000003b SystemErr R at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
[1/4/11 14:59:01:291 CST] 0000003b SystemErr R at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
---------------------------------------------------------------------------------
/*here is the program i have written */
try {
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("/home/it/Test/current/catdownload.sh");
int exitVal = proc.exitValue();
System.out.println("Process exitValue: " + exitVal);
proc.waitFor();
} catch (Throwable t) {
t.printStackTrace();
}
try{
readtextfile();
}
catch(exception e)
{
}