my dog learned polymorphism*
The moose likes Distributed Java and the fly likes Runtime Process exec() method's default timeout method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "Runtime Process exec() method Watch "Runtime Process exec() method New topic

Runtime Process exec() method's default timeout method

Akshay Sahu

Joined: Sep 04, 2009
Posts: 26

Hello All,

I wrote a shell script to move files from one folder to other. (Say folder1 to folder2 and say I am trying to move 2000 files)

Now when I am executing the shell script directly, I am able to move all the files from folder1 to folder2.
When I am executing the same shell script from a standalone Java Program (Runtime.getRuntime().exec()), even then I am able to move all the files from folder1 to folder2.

But whenever I am executing the same java program from within a servlet, I am able to move only 500-688 files at one stretch.

Can anyone help me with this ? Does any process, getting executed from JVM will have a default timeout period.

Thanks and Regards,
Akshay Sahu

Akshay Sahu
OCBCD (EJB 3), OCJP (Java SE 6), MCTS (MS SQL Server 2005)
Richard Tookey
Ranch Hand

Joined: Aug 27, 2012
Posts: 1035

I'm not aware of any Runtime.exec() timeout but of course you could be running into a Servlet timeout. If not then the chances are you are not avoiding the traps detailed in but without a view of your code it is difficult to be certain.

lovely singh

Joined: Mar 08, 2013
Posts: 1
I am new to java and wanted to know that how can i call c/c++ from java, and what should i do if i want to call all the library files in java by coding, even i want the c/c++ files should be compiled and executed. Actually i am making one java editor in which i can compile and execute the c/c++ code both , the GUI part is almost finished but having difficulty in calling them. Please some one help me.

Thanks in advanced
I agree. Here's the link:
subject: Runtime Process exec() method's default timeout method
Similar Threads
return a value from shell script to java program
Unable to execute this command in java-No error but no output
Package Problem
folder contains multiple folders
Project folder name in NetBeans interfering with JSF/GlassFish deployment