-
Executing Unix command through Java
Hi,
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
at java.lang.UNIXProcess.<init>(UNIXProcess.java:148)
at java.lang.ProcessImpl.start(ProcessImpl.java:65)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
at java.lang.Runtime.exec(Runtime.java:591)
at java.lang.Runtime.exec(Runtime.java:429)
at java.lang.Runtime.exec(Runtime.java:326)
Anybody has any idea why is this happening? Thanks.
Aulia
-
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...
Similar Threads
-
Replies: 9
Last Post: 09-19-2007, 05:58 AM
-
Replies: 1
Last Post: 06-12-2006, 11:20 AM
-
By JJ in forum Enterprise
Replies: 1
Last Post: 07-06-2000, 04:50 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
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
|
Bookmarks