Executing Unix command through Java
I am trying to run some unix command through:
Runtime.getRuntime().exec("some unix command line");
I am running the code on Linux platform. However, I always got some errors. Here are the stack trace of them:
java.io.IOException: Cannot allocate memory
java.io.IOException: java.io.IOException: Cannot allocate memory
Anybody has any idea why is this happening? Thanks.
The footprint of your process is too big to fit in memory again. Runtime.exec() calls fork() (a system call) which essentially copies your running process to start the new one.
Increase your swap, free some ram or give your java virtual machine less.
You can also hope that Sun fixes Runtime.exec() to use the vfork() system call sometime... Perhaps they have already in Java 6, I don't know...
Last Post: 09-19-2007, 06:58 AM
Last Post: 06-12-2006, 12:20 PM
By JJ in forum Enterprise
Last Post: 07-06-2000, 05:50 AM
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL