Java Doc for ExecHelper.java in  » Template-Engine » ostermillerutils » com » Ostermiller » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Template Engine » ostermillerutils » com.Ostermiller.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.Ostermiller.util.ExecHelper

ExecHelper
final public class ExecHelper (Code)
Convenience methods for executing non-Java processes. More information about this class is available from ostermiller.org.
author:
   Stephen Ostermiller http://ostermiller.org/contact.pl?regarding=Java+Utilities
since:
   ostermillerutils 1.06.00




Method Summary
public static  ExecHelperexec(String[] cmdarray)
     Executes the specified command and arguments in a separate process, and waits for the process to finish.

Output from the process is expected to be text in the system's default character set.

No input is passed to the process on STDIN.
Parameters:
  cmdarray - array containing the command to call and its arguments.

public static  ExecHelperexec(String[] cmdarray, String[] envp)
     Executes the specified command and arguments in a separate process, and waits for the process to finish.

Output from the process is expected to be text in the system's default character set.

No input is passed to the process on STDIN.
Parameters:
  cmdarray - array containing the command to call and its arguments.
Parameters:
  envp - array of strings, each element of which has environment variable settings in format name=value.

public static  ExecHelperexec(String[] cmdarray, String[] envp, File dir)
     Executes the specified command and arguments in a separate process, and waits for the process to finish.

Output from the process is expected to be text in the system's default character set.

No input is passed to the process on STDIN.
Parameters:
  cmdarray - array containing the command to call and its arguments.
Parameters:
  envp - array of strings, each element of which has environment variable settings in format name=value.
Parameters:
  dir - the working directory of the subprocess, or null if the subprocess should inherit the working directory of the current process.

public static  ExecHelperexec(String[] cmdarray, String charset)
     Executes the specified command and arguments in a separate process, and waits for the process to finish.

No input is passed to the process on STDIN.
Parameters:
  cmdarray - array containing the command to call and its arguments.
Parameters:
  charset - Output from the executed command is expected to be in this character set.

public static  ExecHelperexec(String[] cmdarray, String[] envp, String charset)
     Executes the specified command and arguments in a separate process, and waits for the process to finish.

No input is passed to the process on STDIN.
Parameters:
  cmdarray - array containing the command to call and its arguments.
Parameters:
  envp - array of strings, each element of which has environment variable settings in format name=value.
Parameters:
  charset - Output from the executed command is expected to be in this character set.

public static  ExecHelperexec(String[] cmdarray, String[] envp, File dir, String charset)
     Executes the specified command and arguments in a separate process, and waits for the process to finish.

No input is passed to the process on STDIN.
Parameters:
  cmdarray - array containing the command to call and its arguments.
Parameters:
  envp - array of strings, each element of which has environment variable settings in format name=value.
Parameters:
  dir - the working directory of the subprocess, or null if the subprocess should inherit the working directory of the current process.
Parameters:
  charset - Output from the executed command is expected to be in this character set.

public static  ExecHelperexecUsingShell(String command)
     Executes the specified command using a shell.
public static  ExecHelperexecUsingShell(String command, String charset)
     Executes the specified command using a shell.
public  StringgetError()
     Get the error output of the job that ran.
public  StringgetOutput()
     Get the output of the job that ran.
public  intgetStatus()
     Get the status of the job that ran.



Method Detail
exec
public static ExecHelper exec(String[] cmdarray) throws IOException(Code)
Executes the specified command and arguments in a separate process, and waits for the process to finish.

Output from the process is expected to be text in the system's default character set.

No input is passed to the process on STDIN.
Parameters:
  cmdarray - array containing the command to call and its arguments. The results of the execution in an ExecHelper object.
throws:
  SecurityException - if a security manager exists and its checkExec method doesn't allow creation of a subprocess.
throws:
  IOException - - if an I/O error occurs
throws:
  NullPointerException - - if cmdarray is null
throws:
  IndexOutOfBoundsException - - if cmdarray is an empty array (has length 0).
since:
   ostermillerutils 1.06.00




exec
public static ExecHelper exec(String[] cmdarray, String[] envp) throws IOException(Code)
Executes the specified command and arguments in a separate process, and waits for the process to finish.

Output from the process is expected to be text in the system's default character set.

No input is passed to the process on STDIN.
Parameters:
  cmdarray - array containing the command to call and its arguments.
Parameters:
  envp - array of strings, each element of which has environment variable settings in format name=value. The results of the execution in an ExecHelper object.
throws:
  SecurityException - if a security manager exists and its checkExec method doesn't allow creation of a subprocess.
throws:
  IOException - - if an I/O error occurs
throws:
  NullPointerException - - if cmdarray is null
throws:
  IndexOutOfBoundsException - - if cmdarray is an empty array (has length 0).
since:
   ostermillerutils 1.06.00




exec
public static ExecHelper exec(String[] cmdarray, String[] envp, File dir) throws IOException(Code)
Executes the specified command and arguments in a separate process, and waits for the process to finish.

Output from the process is expected to be text in the system's default character set.

No input is passed to the process on STDIN.
Parameters:
  cmdarray - array containing the command to call and its arguments.
Parameters:
  envp - array of strings, each element of which has environment variable settings in format name=value.
Parameters:
  dir - the working directory of the subprocess, or null if the subprocess should inherit the working directory of the current process. The results of the execution in an ExecHelper object.
throws:
  SecurityException - if a security manager exists and its checkExec method doesn't allow creation of a subprocess.
throws:
  IOException - - if an I/O error occurs
throws:
  NullPointerException - - if cmdarray is null
throws:
  IndexOutOfBoundsException - - if cmdarray is an empty array (has length 0).
since:
   ostermillerutils 1.06.00




exec
public static ExecHelper exec(String[] cmdarray, String charset) throws IOException(Code)
Executes the specified command and arguments in a separate process, and waits for the process to finish.

No input is passed to the process on STDIN.
Parameters:
  cmdarray - array containing the command to call and its arguments.
Parameters:
  charset - Output from the executed command is expected to be in this character set. The results of the execution in an ExecHelper object.
throws:
  SecurityException - if a security manager exists and its checkExec method doesn't allow creation of a subprocess.
throws:
  IOException - - if an I/O error occurs
throws:
  NullPointerException - - if cmdarray is null
throws:
  IndexOutOfBoundsException - - if cmdarray is an empty array (has length 0).
since:
   ostermillerutils 1.06.00




exec
public static ExecHelper exec(String[] cmdarray, String[] envp, String charset) throws IOException(Code)
Executes the specified command and arguments in a separate process, and waits for the process to finish.

No input is passed to the process on STDIN.
Parameters:
  cmdarray - array containing the command to call and its arguments.
Parameters:
  envp - array of strings, each element of which has environment variable settings in format name=value.
Parameters:
  charset - Output from the executed command is expected to be in this character set. The results of the execution in an ExecHelper object.
throws:
  SecurityException - if a security manager exists and its checkExec method doesn't allow creation of a subprocess.
throws:
  IOException - - if an I/O error occurs
throws:
  NullPointerException - - if cmdarray is null
throws:
  IndexOutOfBoundsException - - if cmdarray is an empty array (has length 0).
since:
   ostermillerutils 1.06.00




exec
public static ExecHelper exec(String[] cmdarray, String[] envp, File dir, String charset) throws IOException(Code)
Executes the specified command and arguments in a separate process, and waits for the process to finish.

No input is passed to the process on STDIN.
Parameters:
  cmdarray - array containing the command to call and its arguments.
Parameters:
  envp - array of strings, each element of which has environment variable settings in format name=value.
Parameters:
  dir - the working directory of the subprocess, or null if the subprocess should inherit the working directory of the current process.
Parameters:
  charset - Output from the executed command is expected to be in this character set. The results of the execution in an ExecHelper object.
throws:
  SecurityException - if a security manager exists and its checkExec method doesn't allow creation of a subprocess.
throws:
  IOException - - if an I/O error occurs
throws:
  NullPointerException - - if cmdarray is null
throws:
  IndexOutOfBoundsException - - if cmdarray is an empty array (has length 0).
since:
   ostermillerutils 1.06.00




execUsingShell
public static ExecHelper execUsingShell(String command) throws IOException(Code)
Executes the specified command using a shell. On windows uses cmd.exe or command.exe. On other platforms it uses /bin/sh.

A shell should be used to execute commands when features such as file redirection, pipes, argument parsing are desired.

Output from the process is expected to be text in the system's default character set.

No input is passed to the process on STDIN.
Parameters:
  command - String containing a command to be parsed by the shell and executed. The results of the execution in an ExecHelper object.
throws:
  SecurityException - if a security manager exists and its checkExec method doesn't allow creation of a subprocess.
throws:
  IOException - - if an I/O error occurs
throws:
  NullPointerException - - if command is null
since:
   ostermillerutils 1.06.00




execUsingShell
public static ExecHelper execUsingShell(String command, String charset) throws IOException(Code)
Executes the specified command using a shell. On windows uses cmd.exe or command.exe. On other platforms it uses /bin/sh.

A shell should be used to execute commands when features such as file redirection, pipes, argument parsing are desired.

No input is passed to the process on STDIN.
Parameters:
  command - String containing a command to be parsed by the shell and executed.
Parameters:
  charset - Output from the executed command is expected to be in this character set. The results of the execution in an ExecHelper object.
throws:
  SecurityException - if a security manager exists and its checkExec method doesn't allow creation of a subprocess.
throws:
  IOException - - if an I/O error occurs
throws:
  NullPointerException - - if command is null
since:
   ostermillerutils 1.06.00




getError
public String getError()(Code)
Get the error output of the job that ran. Everything the executed process wrote to its standard error as a String.
since:
   ostermillerutils 1.06.00



getOutput
public String getOutput()(Code)
Get the output of the job that ran. Everything the executed process wrote to its standard output as a String.
since:
   ostermillerutils 1.06.00



getStatus
public int getStatus()(Code)
Get the status of the job that ran. exit status of the executed process, by convention, the value 0 indicates normal termination.
since:
   ostermillerutils 1.06.00



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.